@Test public void testGet_shouldReturnSameList_ifUnderlyingListHasNotChanged() { modelObjects.add(42); List<SimplePmo> list = itemSupplier.get(); List<SimplePmo> list2 = itemSupplier.get(); assertThat(list == list2); }
@Override public List<PMO> get() { List<? extends MO> actualModelObjects = modelObjectSupplier.get(); requireNonNull(actualModelObjects, "modelObjectSupplier must supply a List of model objects (which may be empty)"); if (hasUnderlyingModelObjectListChanged(actualModelObjects)) { HashSet<? extends MO> actualModelObjectsSet = new HashSet<>(actualModelObjects); itemMap.keySet().removeIf(o -> !actualModelObjectsSet.contains(o)); items = new LinkedList<>(); actualModelObjects.forEach(mo -> items.add(applymo2pmoMapping(mo))); modelObjectsCopy = new ArrayList<>(actualModelObjects); } return items; }
SimpleItemSupplier implements Supplier<List<PMO>> { @Override public List<PMO> get() { List<? extends MO> actualModelObjects = modelObjectSupplier.get(); requireNonNull(actualModelObjects, "modelObjectSupplier must supply a List of model objects (which may be empty)"); if (hasUnderlyingModelObjectListChanged(actualModelObjects)) { HashSet<? extends MO> actualModelObjectsSet = new HashSet<>(actualModelObjects); itemMap.keySet().removeIf(o -> !actualModelObjectsSet.contains(o)); items = new LinkedList<>(); actualModelObjects.forEach(mo -> items.add(applymo2pmoMapping(mo))); modelObjectsCopy = new ArrayList<>(actualModelObjects); } return items; } }
SimpleItemSupplier implements Supplier<List<PMO>> { @Override public List<PMO> get() { List<? extends MO> actualModelObjects = modelObjectSupplier.get(); requireNonNull(actualModelObjects, "modelObjectSupplier must supply a List of model objects (which may be empty)"); if (hasUnderlyingModelObjectListChanged(actualModelObjects)) { HashSet<? extends MO> actualModelObjectsSet = new HashSet<>(actualModelObjects); itemMap.keySet().removeIf(o -> !actualModelObjectsSet.contains(o)); items = new LinkedList<>(); actualModelObjects.forEach(mo -> items.add(applymo2pmoMapping(mo))); modelObjectsCopy = new ArrayList<>(actualModelObjects); } return items; } SimpleItemSupplier(Supplier<? extends List<? extends MO>> modelObjectSupplier,
            Function<MO, PMO> mo2pmoMapping); }
SimpleItemSupplier implements Supplier<List<PMO>> { @Override public List<PMO> get() { List<? extends MO> actualModelObjects = modelObjectSupplier.get(); requireNonNull(actualModelObjects, "modelObjectSupplier must supply a List of model objects (which may be empty)"); if (hasUnderlyingModelObjectListChanged(actualModelObjects)) { HashSet<? extends MO> actualModelObjectsSet = new HashSet<>(actualModelObjects); itemMap.keySet().removeIf(o -> !actualModelObjectsSet.contains(o)); items = new LinkedList<>(); actualModelObjects.forEach(mo -> items.add(applymo2pmoMapping(mo))); modelObjectsCopy = new ArrayList<>(actualModelObjects); } return items; } SimpleItemSupplier(Supplier<? extends List<? extends MO>> modelObjectSupplier,
            Function<MO, PMO> mo2pmoMapping); @Override List<PMO> get(); }
SimpleItemSupplier implements Supplier<List<PMO>> { @Override public List<PMO> get() { List<? extends MO> actualModelObjects = modelObjectSupplier.get(); requireNonNull(actualModelObjects, "modelObjectSupplier must supply a List of model objects (which may be empty)"); if (hasUnderlyingModelObjectListChanged(actualModelObjects)) { HashSet<? extends MO> actualModelObjectsSet = new HashSet<>(actualModelObjects); itemMap.keySet().removeIf(o -> !actualModelObjectsSet.contains(o)); items = new LinkedList<>(); actualModelObjects.forEach(mo -> items.add(applymo2pmoMapping(mo))); modelObjectsCopy = new ArrayList<>(actualModelObjects); } return items; } SimpleItemSupplier(Supplier<? extends List<? extends MO>> modelObjectSupplier,
            Function<MO, PMO> mo2pmoMapping); @Override List<PMO> get();  }