Let's say you have an enum. You have an array of objects, where one of the fields is of that enum type. You want to filter the array of objects where the value of the enum is PAYMENTMETHOD.

You also hate equals signs.

Jacqueline found IntelliJ screaming out a litany of warnings, and while tracking down the reasons, she found this bit of Java:

.filter(e -> Arrays.asList(SRN.Type.PAYMENTMETHOD).contains(e.getTxfr().getSourceOrThrow().getType()))

Arrays.asList has an array-valued parameter, so it turns SRN.Type.PAYMENTMETHOD into a List object with one item in it, then checks to se if e.getTxfr()...getType()'s result happens to be in that list. With one object.

The list being filtered might contain many objects- this is part of a pretty large transaction processing system which is handling millions of records. And yes, this code creates a new list object with one item in it for every record.

Jacqueline was able to significantly increase throughput by taking the radical action of replacing this with a more straightforward equals comparison.

[Advertisement] Utilize BuildMaster to release your software with confidence, at the pace your business demands. Download today!