Explicit forEach
This commit is contained in:
parent
931bd443c2
commit
b1e88ad283
|
@ -4,6 +4,7 @@ import java.io.IOException;
|
|||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.bson.Document;
|
||||
import org.bson.types.ObjectId;
|
||||
|
@ -105,16 +106,22 @@ public class ConcessioniMongoManager extends MongoManager{
|
|||
return asConcessione(replace(asDocument(toReturn),collectionName));
|
||||
}
|
||||
|
||||
|
||||
|
||||
public List<Concessione> list(){
|
||||
ArrayList<Concessione> toReturn=new ArrayList<>();
|
||||
iterate(null, collectionName).forEach((Document d)->{
|
||||
try {
|
||||
toReturn.add(asConcessione(d));
|
||||
}catch(Throwable t) {
|
||||
log.error("Unable to read Document as concessione ",t);
|
||||
log.debug("Document was "+d.toJson());
|
||||
}
|
||||
});
|
||||
iterate(null, collectionName).forEach(
|
||||
new Consumer<Document>() {
|
||||
@Override
|
||||
public void accept(Document d) {
|
||||
try {
|
||||
toReturn.add(asConcessione(d));
|
||||
}catch(Throwable t) {
|
||||
log.error("Unable to read Document as concessione ",t);
|
||||
log.debug("Document was "+d.toJson());
|
||||
}
|
||||
}
|
||||
});
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
|
|
Reference in New Issue