List<ReplicaUnderConstruction> getStaleReplicas(long genStamp) { List<ReplicaUnderConstruction> staleReplicas = new ArrayList<>(); // Remove replicas with wrong gen stamp. The replica list is unchanged. for (ReplicaUnderConstruction r : replicas) { if (genStamp != r.getGenerationStamp()) { staleReplicas.add(r); } } return staleReplicas; }