java类com.google.common.collect.Lists的实例源码

TestKeyValueCompression.java 文件源码 项目:ditb 阅读 20 收藏 0 点赞 0 评论 0
@Test
public void testRepeatingKVs() throws Exception {
  List<KeyValue> kvs = Lists.newArrayList();
  for (int i = 0; i < 400; i++) {
    byte[] row = Bytes.toBytes("row" + (i % 10));
    byte[] fam = Bytes.toBytes("fam" + (i % 127));
    byte[] qual = Bytes.toBytes("qual" + (i % 128));
    kvs.add(new KeyValue(row, fam, qual, 12345L, VALUE));
  }

  runTestCycle(kvs);
}
InstanceManager.java 文件源码 项目:OneClient 阅读 33 收藏 0 点赞 0 评论 0
public static ObservableList<Instance> getRecentInstances() {
    loadRecent();
    if (getInstances().isEmpty())
        return FXCollections.emptyObservableList();
    List<Instance> recent = Lists.newArrayList();
    for (String name : RECENT_INSTANCES) {
        if (INSTANCES_MAP.containsKey(name))
            recent.add(INSTANCES_MAP.get(name));
    }
    if (recent.isEmpty()) {
        int size = getInstances().size();
        return FXCollections.observableArrayList(getInstances().subList(0, Math.min(size, MAX_RECENT)));
    }
    return FXCollections.observableArrayList(recent);
}
AnvilSaveConverter.java 文件源码 项目:Backmemed 阅读 27 收藏 0 点赞 0 评论 0
public List<WorldSummary> getSaveList() throws AnvilConverterException
{
    if (this.savesDirectory != null && this.savesDirectory.exists() && this.savesDirectory.isDirectory())
    {
        List<WorldSummary> list = Lists.<WorldSummary>newArrayList();
        File[] afile = this.savesDirectory.listFiles();

        for (File file1 : afile)
        {
            if (file1.isDirectory())
            {
                String s = file1.getName();
                WorldInfo worldinfo = this.getWorldInfo(s);

                if (worldinfo != null && (worldinfo.getSaveVersion() == 19132 || worldinfo.getSaveVersion() == 19133))
                {
                    boolean flag = worldinfo.getSaveVersion() != this.getSaveVersion();
                    String s1 = worldinfo.getWorldName();

                    if (StringUtils.isEmpty(s1))
                    {
                        s1 = s;
                    }

                    long i = 0L;
                    list.add(new WorldSummary(worldinfo, s, s1, 0L, flag));
                }
            }
        }

        return list;
    }
    else
    {
        throw new AnvilConverterException(I18n.translateToLocal("selectWorld.load_folder_access"));
    }
}
FluidHandlerConcatenate.java 文件源码 项目:CustomWorldGen 阅读 28 收藏 0 点赞 0 评论 0
@Override
public IFluidTankProperties[] getTankProperties()
{
    List<IFluidTankProperties> tanks = Lists.newArrayList();
    for (IFluidHandler handler : subHandlers)
    {
        Collections.addAll(tanks, handler.getTankProperties());
    }
    return tanks.toArray(new IFluidTankProperties[tanks.size()]);
}
StructureStrongholdPieces.java 文件源码 项目:CustomWorldGen 阅读 31 收藏 0 点赞 0 评论 0
/**
 * sets up Arrays with the Structure pieces and their weights
 */
public static void prepareStructurePieces()
{
    structurePieceList = Lists.<StructureStrongholdPieces.PieceWeight>newArrayList();

    for (StructureStrongholdPieces.PieceWeight structurestrongholdpieces$pieceweight : PIECE_WEIGHTS)
    {
        structurestrongholdpieces$pieceweight.instancesSpawned = 0;
        structurePieceList.add(structurestrongholdpieces$pieceweight);
    }

    strongComponentType = null;
}
EsHttpSourceTestOperations.java 文件源码 项目:crawling-framework 阅读 15 收藏 0 点赞 0 评论 0
public List<HttpSourceTest> all() {
    BoolQueryBuilder filter = QueryBuilders.boolQuery()
            .must(QueryBuilders.existsQuery("source_url"));


    Client client = getConnection().getClient();
    TimeValue keepAlive = TimeValue.timeValueMinutes(10);
    SearchResponse response = client.prepareSearch(getIndex())
            .setTypes(getType())
            .setPostFilter(filter)
            .setSize(100)
            .setScroll(keepAlive)
            .setFetchSource(true)
            .setExplain(false)
            .execute()
            .actionGet();

    List<HttpSourceTest> result = Lists.newArrayList();
    do {
        result.addAll(Arrays.stream(response.getHits().getHits())
                .map(SearchHit::getSource)
                .filter(Objects::nonNull)
                .map(this::mapToHttpSourceTest)
                .collect(Collectors.toList()));
        response = client.prepareSearchScroll(response.getScrollId())
                .setScroll(keepAlive)
                .execute()
                .actionGet();
    } while (response.getHits().getHits().length != 0);
    return result;
}
DefaultClasspathSnapshotter.java 文件源码 项目:Reer 阅读 21 收藏 0 点赞 0 评论 0
@Override
protected void visitDirectoryTree(DirectoryFileTree directoryTree, List<DefaultFileDetails> fileTreeElements) {
    // Sort non-root elements as their order is not important
    List<DefaultFileDetails> subElements = Lists.newArrayList();
    super.visitDirectoryTree(directoryTree, subElements);
    Collections.sort(subElements, FILE_DETAILS_COMPARATOR);
    fileTreeElements.addAll(subElements);
}
MeldingBepalerServiceImpl.java 文件源码 项目:OperatieBRP 阅读 24 收藏 0 点赞 0 评论 0
@Override
public List<Melding> geefWaarschuwingen(final List<BijgehoudenPersoon> bijgehoudenPersoonList) {
    final List<Melding> meldingList = Lists.newLinkedList();
    bijgehoudenPersoonList.forEach(
            persoon -> controleerVerstrekkingbeperkingOpPersoon(persoon.getPersoonslijst(), persoon.getCommunicatieId(), meldingList));
    return meldingList;
}
BeanValidators.java 文件源码 项目:angit 阅读 27 收藏 0 点赞 0 评论 0
/**
 * 辅助方法, 转换Set<ConstraintViolation>为List<message>
 *
 * @param constraintViolations the constraint violations
 * @return the list
 */
@SuppressWarnings("rawtypes")
public static List<String> extractMessage(Set<? extends ConstraintViolation> constraintViolations) {
    List<String> errorMessages = Lists.newArrayList();
    errorMessages.addAll(constraintViolations.stream().map((Function<ConstraintViolation, String>) ConstraintViolation::getMessage).collect(Collectors.toList()));
    return errorMessages;
}
BspListDataStrategy.java 文件源码 项目:Pogamut3 阅读 17 收藏 0 点赞 0 评论 0
/** Split data
* 
* See {@link IBspStrategy#splitData(Object, Object)}
*/
  public SplitData<ArrayList<TElement>> splitData(TBoundary boundary, ArrayList<TElement> data) {
      ArrayList<TElement> positiveData = Lists.newArrayList();
      ArrayList<TElement> negativeData = Lists.newArrayList();

      for (TElement element : data) {
          BspOccupation occupation = determineElementOccupation(boundary, element);

          if (occupation.intersectsPositive()) {
              positiveData.add(element);
          }

          if (occupation.intersectsNegative()) {
              negativeData.add(element);
          }
      }

      if ( positiveData.isEmpty() ) {
        positiveData = null;
      }

      if ( negativeData.isEmpty() ) {
        negativeData = null;
      } 

      return new SplitData<ArrayList<TElement>>( negativeData, positiveData );
  }


问题


面经


文章

微信
公众号

扫码关注公众号