当前位置: 首页>>代码示例>>Java>>正文


Java Lists.newArrayList方法代码示例

本文整理汇总了Java中com.google.common.collect.Lists.newArrayList方法的典型用法代码示例。如果您正苦于以下问题:Java Lists.newArrayList方法的具体用法?Java Lists.newArrayList怎么用?Java Lists.newArrayList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.common.collect.Lists的用法示例。


在下文中一共展示了Lists.newArrayList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: rollForwardByApplyingLogs

import com.google.common.collect.Lists; //导入方法依赖的package包/类
static void rollForwardByApplyingLogs(
    RemoteEditLogManifest manifest,
    FSImage dstImage,
    FSNamesystem dstNamesystem) throws IOException {
  NNStorage dstStorage = dstImage.getStorage();

  List<EditLogInputStream> editsStreams = Lists.newArrayList();    
  for (RemoteEditLog log : manifest.getLogs()) {
    if (log.getEndTxId() > dstImage.getLastAppliedTxId()) {
      File f = dstStorage.findFinalizedEditsFile(
          log.getStartTxId(), log.getEndTxId());
      editsStreams.add(new EditLogFileInputStream(f, log.getStartTxId(), 
                                                  log.getEndTxId(), true));
    }
  }
  LOG.info("Checkpointer about to load edits from " +
      editsStreams.size() + " stream(s).");
  dstImage.loadEdits(editsStreams, dstNamesystem);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:20,代码来源:Checkpointer.java

示例2: testDate_Part

import com.google.common.collect.Lists; //导入方法依赖的package包/类
@Test
public void testDate_Part() throws Exception {
  final String query = "select date_part('year', date '2008-2-23') as col \n" +
      "from cp.`tpch/region.parquet` \n" +
      "limit 0";

  List<Pair<SchemaPath, MajorType>> expectedSchema = Lists.newArrayList();
  MajorType majorType = Types.required(MinorType.BIGINT);
  expectedSchema.add(Pair.of(SchemaPath.getSimplePath("col"), majorType));

  testBuilder()
      .sqlQuery(query)
      .schemaBaseLine(expectedSchema)
      .build()
      .run();
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:17,代码来源:TestFunctionsWithTypeExpoQueries.java

示例3: getOrderCartProduct

import com.google.common.collect.Lists; //导入方法依赖的package包/类
public ServerResponse getOrderCartProduct(Integer userId) {
    OrderProductVo orderProductVo = new OrderProductVo();

    List<Cart> cartList = cartMapper.selectCheckedCartByUserId(userId);
    ServerResponse serverResponse = this.getCartOrderItem(userId, cartList);

    if (!serverResponse.isSuccess()) {
        return serverResponse;
    }
    List<OrderItem> orderItemList = (List<OrderItem>) serverResponse.getData();

    List<OrderItemVo> orderItemVoList = Lists.newArrayList();

    BigDecimal payment = new BigDecimal("0");
    for (OrderItem orderItem : orderItemList) {
        payment = BigDecimalUtil.add(payment.doubleValue(), orderItem.getTotalPrice().doubleValue());
        orderItemVoList.add(assembleOrderItemVo(orderItem));
    }
    orderProductVo.setProductTotalPrice(payment);
    orderProductVo.setOrderItemVoList(orderItemVoList);
    orderProductVo.setImageHost(PropertiesUtil.getProperty("ftp.server.http.prefix"));

    return ServerResponse.createBySuccess(orderProductVo);
}
 
开发者ID:Liweimin0512,项目名称:MMall_JAVA,代码行数:25,代码来源:OrderServiceImpl.java

示例4: addTabCompletionOptions

import com.google.common.collect.Lists; //导入方法依赖的package包/类
public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos)
{
    if (args.length == 1)
    {
        Scoreboard scoreboard = MinecraftServer.getServer().worldServerForDimension(0).getScoreboard();
        List<String> list = Lists.<String>newArrayList();

        for (ScoreObjective scoreobjective : scoreboard.getScoreObjectives())
        {
            if (scoreobjective.getCriteria() == IScoreObjectiveCriteria.TRIGGER)
            {
                list.add(scoreobjective.getName());
            }
        }

        return getListOfStringsMatchingLastWord(args, (String[])list.toArray(new String[list.size()]));
    }
    else
    {
        return args.length == 2 ? getListOfStringsMatchingLastWord(args, new String[] {"add", "set"}): null;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:23,代码来源:CommandTrigger.java

示例5: deserialize

import com.google.common.collect.Lists; //导入方法依赖的package包/类
@Override
public List<Object> deserialize(ByteBuffer ser) {
    // If this flag is true, return null.
    if (returnNull) {
        return null;
    }

    // Probably a better way to do this juggling.
    if (ser == null) {
        return null;
    }
    ser.rewind();
    byte[] bytes = new byte[ser.remaining()];
    ser.get(bytes, 0, bytes.length);

    return Lists.newArrayList(new String(bytes, Charsets.UTF_8));
}
 
开发者ID:salesforce,项目名称:storm-dynamic-spout,代码行数:18,代码来源:AbstractSchemeTest.java

示例6: withTasksExceedingTimeout

import com.google.common.collect.Lists; //导入方法依赖的package包/类
@Test
public void withTasksExceedingTimeout() throws Exception {
  UserException ex = null;

  try {
    List<TimedRunnable<Void>> tasks = Lists.newArrayList();

    for (int i = 0; i < 100; i++) {
      if ((i & (i + 1)) == 0) {
        tasks.add(new TestTask(2000));
      } else {
        tasks.add(new TestTask(20000));
      }
    }

    TimedRunnable.run("Execution with some tasks triggering timeout", logger, tasks, 16);
  } catch (UserException e) {
    ex = e;
  }

  assertNotNull("Expected a UserException", ex);
  assertThat(ex.getMessage(),
      containsString("Waited for 93750ms, but tasks for 'Execution with some tasks triggering timeout' are not " +
          "complete. Total runnable size 100, parallelism 16."));
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:26,代码来源:TestTimedRunnable.java

示例7: nonExistingPartitionsAreFiltered

import com.google.common.collect.Lists; //导入方法依赖的package包/类
@Test
public void nonExistingPartitionsAreFiltered() throws Exception {
  List<Partition> filteredPartitions = Lists.newArrayList(sourcePartition1);
  when(source.getLocationManager(sourceTable, filteredPartitions, EVENT_ID, copierOptions))
      .thenReturn(sourceLocationManager);
  when(source.getPartitions(sourceTable, PARTITION_PREDICATE, MAX_PARTITIONS)).thenReturn(partitionsAndStatistics);
  when(replica.getTable(replicaClient, DATABASE, TABLE)).thenReturn(Optional.of(previousReplicaTable));
  when(previousReplicaTable.getSd()).thenReturn(sd);
  when(sd.getLocation()).thenReturn(tableLocation);
  // mimics that the first partitions exist but second partition didn't so it will be filtered
  when(replicaClient.getPartition(DATABASE, TABLE, sourcePartition2.getValues()))
      .thenThrow(new NoSuchObjectException());

  PartitionedTableMetadataUpdateReplication replication = new PartitionedTableMetadataUpdateReplication(DATABASE,
      TABLE, partitionPredicate, source, replica, eventIdFactory, replicaLocation, DATABASE, TABLE);
  replication.replicate();

  InOrder replicationOrder = inOrder(sourceLocationManager, replica);
  replicationOrder.verify(replica).validateReplicaTable(DATABASE, TABLE);
  ArgumentCaptor<PartitionsAndStatistics> partitionsAndStatisticsCaptor = ArgumentCaptor
      .forClass(PartitionsAndStatistics.class);
  replicationOrder.verify(replica).updateMetadata(eq(EVENT_ID), eq(sourceTableAndStatistics),
      partitionsAndStatisticsCaptor.capture(), eq(sourceLocationManager), eq(DATABASE), eq(TABLE),
      any(ReplicaLocationManager.class));
  PartitionsAndStatistics value = partitionsAndStatisticsCaptor.getValue();
  assertThat(value.getPartitions().size(), is(1));
  assertThat(value.getPartitionNames().get(0), is("a=1"));
}
 
开发者ID:HotelsDotCom,项目名称:circus-train,代码行数:29,代码来源:PartitionedTableMetadataUpdateReplicationTest.java

示例8: test1

import com.google.common.collect.Lists; //导入方法依赖的package包/类
@Test
public void test1() {
    List<String> list = Lists.newArrayList("我 3 公斤 ipad 30 公斤".split(" "));

    FST<String> fst = new FST<String>();

    fst.start()
            .edge(FstCondition.pattern("\\d+"), "数字")
            .edge(FstCondition.in(Sets.newHashSet("公斤")), "$$");

    fst.start()
            .edge(FstCondition.pattern("\\w+"), "单词").
            edge(FstCondition.pattern("\\d+"), "$$");


    fst.fluze();

    FstMatcher<String, String> m = fst.newMatcher(list);

    while (m.find()) {
        System.out.println(m.getStart() + "-" + m.getLength() + " " + list.subList(m.getStart(), m.getStart() + m.getLength()));
    }

    //
    // long t1 = System.currentTimeMillis();
    // for(int i=0;i<1000000;i++){
    // int j=0;
    // FstMatcher<Integer,Vertex> m1 = fst.newMatcher();
    // for(Vertex v : list){
    // m1.input(j++, v, fp);
    // }
    // }
    // long t2 = System.currentTimeMillis();
    // System.out.println(t2-t1);
}
 
开发者ID:mayabot,项目名称:mynlp,代码行数:36,代码来源:FstMainTest.java

示例9: RecordingBinder

import com.google.common.collect.Lists; //导入方法依赖的package包/类
private RecordingBinder(Stage stage) {
  this.stage = stage;
  this.modules = Maps.newLinkedHashMap();
  this.scanners = Sets.newLinkedHashSet();
  this.elements = Lists.newArrayList();
  this.source = null;
  this.sourceProvider = SourceProvider.DEFAULT_INSTANCE.plusSkippedClasses(
      Elements.class, RecordingBinder.class, AbstractModule.class,
      ConstantBindingBuilderImpl.class, AbstractBindingBuilder.class, BindingBuilder.class);
  this.parent = null;
  this.privateElements = null;
  this.privateBinders = Lists.newArrayList();
}
 
开发者ID:maetrive,项目名称:businessworks,代码行数:14,代码来源:Elements.java

示例10: getChildNodes

import com.google.common.collect.Lists; //导入方法依赖的package包/类
@Override
public List<HtmlTreeNode> getChildNodes(SectionInfo info, String xpath)
{
	final List<HtmlTreeNode> list = Lists.newArrayList();
	Long schemaId = getModel(info).getSelectedSchema();
	if( schemaId == 0 )
	{
		return Collections.emptyList();
	}
	Schema schema = schemaService.get(schemaId);

	if( xpath == null )
	{
		xpath = "";
	}

	final PropBagEx schemaXml = schema.getDefinitionNonThreadSafe();
	for( PropBagEx child : schemaXml.iterator(xpath + "/*") )
	{
		String name = child.getNodeName();
		if( isAttribute(child) )
		{
			name = "@" + name;
		}
		String fullpath = Check.isEmpty(xpath) ? name : MessageFormat.format("{0}/{1}", xpath, name);
		list.add(new SchemaTreeNode(name, fullpath, isLeaf(child), isSelected(info, fullpath)));
	}

	return list;
}
 
开发者ID:equella,项目名称:Equella,代码行数:31,代码来源:BulkEditMetadataSection.java

示例11: mergeResults

import com.google.common.collect.Lists; //导入方法依赖的package包/类
private DependentBinariesResolvedResult mergeResults(Collection<DependentBinariesResolvedResult> results) {
    DependentBinariesResolvedResult first = results.iterator().next();
    if (results.size() == 1) {
        return first;
    }
    boolean hasNotBuildables = false;
    boolean hasTestSuites = false;
    LinkedListMultimap<LibraryBinaryIdentifier, DependentBinariesResolvedResult> index = LinkedListMultimap.create();
    List<DependentBinariesResolvedResult> allChildren = Lists.newArrayList();
    for (DependentBinariesResolvedResult result : results) {
        if (!result.isBuildable()) {
            hasNotBuildables = true;
        }
        if (result.isTestSuite()) {
            hasTestSuites = true;
        }
        allChildren.addAll(result.getChildren());
        for (DependentBinariesResolvedResult child : result.getChildren()) {
            index.put(child.getId(), child);
        }
    }
    List<DependentBinariesResolvedResult> children = Lists.newArrayList();
    for (Collection<DependentBinariesResolvedResult> childResults : index.asMap().values()) {
        children.add(mergeResults(childResults));
    }
    return new DefaultDependentBinariesResolvedResult(first.getId(), first.getProjectScopedName(), !hasNotBuildables, hasTestSuites, children);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:28,代码来源:DefaultDependentBinariesResolver.java

示例12: getStacksPathItems

import com.google.common.collect.Lists; //导入方法依赖的package包/类
List<PathItem> getStacksPathItems(Map<XreStackPath, Integer> stackToNodesCount, final Map<XreStackPath, Integer> whitelistedStackToNodesCount) {
    return Lists.newArrayList(Collections2.transform(stackToNodesCount.entrySet(), new Function<Map.Entry<XreStackPath, Integer>, PathItem>() {
        @Override
        public PathItem apply(Map.Entry<XreStackPath, Integer> input) {
            XreStackPath stack = input.getKey();
            int count = input.getValue();
            int whitelistedCount = whitelistedStackToNodesCount.containsKey(stack)
                    ? whitelistedStackToNodesCount.get(stack) : 0;

            return new PathItem(stack.getStackAndFlavorPath(), count, whitelistedCount);
        }
    }));
}
 
开发者ID:Comcast,项目名称:redirector,代码行数:14,代码来源:StacksService.java

示例13: setup

import com.google.common.collect.Lists; //导入方法依赖的package包/类
@Override
public void setup(OperatorContext context, OutputMutator output) throws ExecutionSetupException {
  this.operatorContext = context;
  this.writer = new VectorContainerWriter(output);
  this.jsonReader = new JsonReader(fragmentContext.getManagedBuffer(), Lists.newArrayList(getColumns()), enableAllTextMode, false, readNumbersAsDouble);

}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:8,代码来源:MongoRecordReader.java

示例14: prepareStructurePieces

import com.google.common.collect.Lists; //导入方法依赖的package包/类
/**
 * sets up Arrays with the Structure pieces and their weights
 */
public static void prepareStructurePieces()
{
    structurePieceList = Lists.<StructureStrongholdPieces.PieceWeight>newArrayList();

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

    strongComponentType = null;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:16,代码来源:StructureStrongholdPieces.java

示例15: defaultArgs

import com.google.common.collect.Lists; //导入方法依赖的package包/类
private String[] defaultArgs(Param param) {
    List<String> res = Lists.newArrayList();
    if(param.hasPathVar()) res.add(param.pathVar);
    if(param.hasName()) res.add(String.format("'%s'", param.name));
    res.add(param.value);
    return res.toArray(new String[res.size()]);
}
 
开发者ID:sdadas,项目名称:spring2ts,代码行数:8,代码来源:TSRequestBuilder.java


注:本文中的com.google.common.collect.Lists.newArrayList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。