LongBits.java 文件源码

java
阅读 70 收藏 0 点赞 0 评论 0

项目:GitHub 作者:
LongPositions(Iterable<? extends Object> elements, final int bitPerLong) {
  this.elements = ImmutableList.copyOf(elements);
  checkArgument(bitPerLong <= BITS_IN_LONG, bitPerLong);

  for (int i = 0; i < this.elements.size(); i++) {
    positions.put(
        this.elements.get(i),
        new BitPosition(
            i / bitPerLong,
            i % bitPerLong));
  }

  this.longPositions = ImmutableSortedMap.copyOf(
      Maps.transformEntries(
          Multimaps.index(positions.values(), ToLongIndex.FUNCTION).asMap(),
          new Maps.EntryTransformer<Integer, Collection<BitPosition>, LongSet>() {
            @Override
            public LongSet transformEntry(Integer key, Collection<BitPosition> position) {
              return new LongSet(key, position);
            }
          }));
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号