private static void addPackages(long[] hashes, StrippedLongToObjectMap<Loader[]> map, Loader loader, @Nullable LongPredicate hashFilter) {
    Loader[] singleArray = null;
    for (long hash : hashes) {
      if (hashFilter != null && !hashFilter.test(hash)) {
        continue;
      }

      int index = map.index(hash);
      if (index < 0) {
        if (singleArray == null) {
          singleArray = new Loader[]{loader};
        }
        map.addByIndex(index, hash, singleArray);
      }
      else {
        Loader[] loaders = map.getByIndex(index);
        Loader[] newList = new Loader[loaders.length + 1];
        System.arraycopy(loaders, 0, newList, 0, loaders.length);
        newList[loaders.length] = loader;
        map.replaceByIndex(index, hash, newList);
      }
    }
  }
private static void addPackages(long[] hashes, StrippedLongToObjectMap<Loader[]> map, Loader loader, @Nullable LongPredicate hashFilter)