Package gw.util

Class GosuCollectionUtil


  • public class GosuCollectionUtil
    extends Object
    • Constructor Detail

      • GosuCollectionUtil

        public GosuCollectionUtil()
    • Method Detail

      • compactAndLockHashMap

        public static <S,​T> Map<S,​T> compactAndLockHashMap​(HashMap<S,​T> map)
        Returns a compacted and locked map representing the map passed in. This method can freely change the implementation type of the map. I.e. it can return an emptyMap, singletonMap, or even a completely different map implementation.
      • compactAndLockList

        public static <T> List<T> compactAndLockList​(List<T> list)
        Returns a compacted and locked list representing the list passed in.
      • startsWith

        public static boolean startsWith​(List<?> list,
                                         List<?> prefix)
        Returns:
        true iff list is at least as big as prefix, and if the first prefix.size() elements are element-wise equal to the elements of prefix.