Utility method for wrapping an object in a collection

java.util.Collections.singleton(object) will give you an immutable Set. singletonList is also available.

Less efficiently java.util.Arrays.asList(object) will give you a mutable (can use list.set(0, x);), but non-structurally changeable (can’t add or remove) List. It is a bit more expensive as there is an extra array that is created client-side.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)