Package gw.util

Class GosuCollectionUtil


  • public class GosuCollectionUtil
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <S,​T>
      java.util.Map<S,​T>
      compactAndLockHashMap​(java.util.HashMap<S,​T> map)
      Returns a compacted and locked map representing the map passed in.
      static <T> java.util.List<T> compactAndLockList​(java.util.List<T> list)
      Returns a compacted and locked list representing the list passed in.
      static boolean startsWith​(java.util.List<?> list, java.util.List<?> prefix)
      String.startsWith(String) for Lists.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GosuCollectionUtil

        public GosuCollectionUtil()
    • Method Detail

      • compactAndLockHashMap

        public static <S,​T> java.util.Map<S,​T> compactAndLockHashMap​(java.util.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> java.util.List<T> compactAndLockList​(java.util.List<T> list)
        Returns a compacted and locked list representing the list passed in.
      • startsWith

        public static boolean startsWith​(java.util.List<?> list,
                                         java.util.List<?> prefix)
        String.startsWith(String) for Lists.
        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.