A utility Java library for a cleaner & simpler code.
Maven dependency Sonatype Central Repository
//with webutils
var iterator = OptionalUtils.ofMappable(collection, Collection::iterator);
//with plain java
var iterator = collection != null ? collection.iterator() : null;
//find mutual objects in both collections
List<String> listOne = List.of("One", "Two", "Three");
List<String> listTwo = List.of("Three", "Four", "Five");
//contains "Three"
var result = CollectionUtils.innerJoin(listOne, listTwo);
//filter stream elements using a predicate
Comparator<String> comparator = (a, b) -> StringUtils.compareIgnoreCase(a, b);
var list = stream.filter(StreamUtils.filterDuplicate(comparator))
.collect(Collectors.toList());
Pull requests are welcome if you want to contribute to this library.