0

I would like to do something like:

final unmodifiableList1 = staticMethodForUnmodifiableList(1,2,3,4);
final unmodifiableList2 = unmodifiableList1.createAndAdd(5);

System.out.println(unmodifiableList1); // prints 1, 2, 3, 4
System.out.println(unmodifiableList2); // prints 1, 2, 3, 4, 5

I have implemented my own solution, but now I realize I would like to have this class in other companies, where I can't reuse my own solution and now I'm thinking if this exist's in any Open Source Library that I could use.

Same would be nice to have for methods like subList and for other collections like unmodifiable Maps, Sets etc.

Best Regards

henry86
  • 129
  • 1
  • 8

1 Answers1

0

For someone interested - I've switched to kotlin language, which solved these problems because kotlin has this methods included (and much more) and is fully compatible with the java source code (and binaries of course)

henry86
  • 129
  • 1
  • 8