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


Java Lists.newLinkedList方法代码示例

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


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

示例1: getLogFile

import com.google.common.collect.Lists; //导入方法依赖的package包/类
public static EditLogFile getLogFile(File dir, long startTxId)
    throws IOException {
  List<EditLogFile> files = matchEditLogs(dir);
  List<EditLogFile> ret = Lists.newLinkedList();
  for (EditLogFile elf : files) {
    if (elf.getFirstTxId() == startTxId) {
      ret.add(elf);
    }
  }
  
  if (ret.isEmpty()) {
    // no matches
    return null;
  } else if (ret.size() == 1) {
    return ret.get(0);
  } else {
    throw new IllegalStateException("More than one log segment in " + 
        dir + " starting at txid " + startTxId + ": " +
        Joiner.on(", ").join(ret));
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:22,代码来源:FileJournalManager.java

示例2: evaluate

import com.google.common.collect.Lists; //导入方法依赖的package包/类
public List<String> evaluate(List<String> input, String baseUrl) {
    LinkedHashSet<String> linkedHashSet = Sets.newLinkedHashSet();
    int i = 0;
    for (String str : input) {
        StringContext stringContext = new StringContext(baseUrl, str, input, i);
        Object calculate = stringFunction.calculate(stringContext);
        if ((calculate instanceof Strings)) {
            linkedHashSet.addAll((Strings) calculate);
        } else if (calculate instanceof CharSequence) {
            linkedHashSet.add(calculate.toString());
        } else {
            log.warn("result type for function: " + stringFunction.functionName() + " is not strings");

        }
        i++;
    }
    return Lists.newLinkedList(linkedHashSet);
}
 
开发者ID:virjar,项目名称:vscrawler,代码行数:19,代码来源:StingEvaluator.java

示例3: testCoalesce

import com.google.common.collect.Lists; //导入方法依赖的package包/类
@Test
public void testCoalesce() throws EventDeliveryException {
  initContextForIncrementHBaseSerializer();
  ctx.put("batchSize", "100");
  ctx.put(HBaseSinkConfigurationConstants.CONFIG_COALESCE_INCREMENTS,
      String.valueOf(true));

  final Map<String, Long> expectedCounts = Maps.newHashMap();
  expectedCounts.put("r1:c1", 10L);
  expectedCounts.put("r1:c2", 20L);
  expectedCounts.put("r2:c1", 7L);
  expectedCounts.put("r2:c3", 63L);
  HBaseSink.DebugIncrementsCallback cb = new CoalesceValidator(expectedCounts);

  HBaseSink sink = new HBaseSink(testUtility.getConfiguration(), cb);
  Configurables.configure(sink, ctx);
  Channel channel = createAndConfigureMemoryChannel(sink);

  List<Event> events = Lists.newLinkedList();
  generateEvents(events, expectedCounts);
  putEvents(channel, events);

  sink.start();
  sink.process(); // Calls CoalesceValidator instance.
  sink.stop();
}
 
开发者ID:moueimei,项目名称:flume-release-1.7.0,代码行数:27,代码来源:TestHBaseSink.java

示例4: dropTablesIfPresent

import com.google.common.collect.Lists; //导入方法依赖的package包/类
/**
 * Drop the specified tables from the schema if they are present.
 *
 * @param tablesToDrop The tables to delete if they are present in the database.
 */
public void dropTablesIfPresent(Set<String> tablesToDrop) {
  ProducerCache producerCache = new ProducerCache();
  try {
    Collection<String> sql = Lists.newLinkedList();
    for (String tableName : tablesToDrop) {
      Table cachedTable = getTable(producerCache, tableName);
      if (cachedTable != null) {
        sql.addAll(dropTable(cachedTable));
      }
    }
    executeScript(sql);
  } finally {
    producerCache.close();
  }
}
 
开发者ID:alfasoftware,项目名称:morf,代码行数:21,代码来源:DatabaseSchemaManager.java

示例5: maakResultaatLijst

import com.google.common.collect.Lists; //导入方法依赖的package包/类
private LijstExpressie maakResultaatLijst(final Predicate<MetaAttribuut> attribuutFilter,
                                          final Collection solve, final Context context) {
    final List<Expressie> resultaatWaarden = Lists.newLinkedList();
    for (final Object metaModel : solve) {
        final Literal literal = maakResultaatLiteral(attribuutFilter, context, metaModel);
        if (literal != null) {
            resultaatWaarden.add(literal);
        }
    }
    return new LijstExpressie(resultaatWaarden);
}
 
开发者ID:MinBZK,项目名称:OperatieBRP,代码行数:12,代码来源:ElementExpressie.java

示例6: readEvents

import com.google.common.collect.Lists; //导入方法依赖的package包/类
public List<Event> readEvents(int numEvents, boolean backoffWithoutNL,
    boolean addByteOffset) throws IOException {
  List<Event> events = Lists.newLinkedList();
  for (int i = 0; i < numEvents; i++) {
    Event event = readEvent(backoffWithoutNL, addByteOffset);
    if (event == null) {
      break;
    }
    events.add(event);
  }
  return events;
}
 
开发者ID:moueimei,项目名称:flume-release-1.7.0,代码行数:13,代码来源:TailFile.java

示例7: iterator

import com.google.common.collect.Lists; //导入方法依赖的package包/类
@Override
public Iterator<LogicalExpression> iterator() {
  List<LogicalExpression> children = Lists.newLinkedList();

  children.add(ifCondition.condition);
  children.add(ifCondition.expression);
  children.add(this.elseExpression);
  return children.iterator();
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:10,代码来源:IfExpression.java

示例8: balanceControllerNodes

import com.google.common.collect.Lists; //导入方法依赖的package包/类
/**
 * Balances the nodes specified in controllerDevices.
 *
 * @param controllerDevices controller nodes to devices map
 * @param deviceCount number of devices mastered by controller nodes
 * @return list of setRole futures for "moved" devices
 */
private List<CompletableFuture<Void>> balanceControllerNodes(
        Map<ControllerNode, Set<DeviceId>> controllerDevices, int deviceCount) {
    // Now re-balance the buckets until they are roughly even.
    List<CompletableFuture<Void>> balanceBucketsFutures = Lists.newLinkedList();
    int rounds = controllerDevices.keySet().size();
    for (int i = 0; i < rounds; i++) {
        // Iterate over the buckets and find the smallest and the largest.
        ControllerNode smallest = findBucket(true, controllerDevices);
        ControllerNode largest = findBucket(false, controllerDevices);
        balanceBucketsFutures.add(balanceBuckets(smallest, largest, controllerDevices, deviceCount));
    }
    return balanceBucketsFutures;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:21,代码来源:MastershipManager.java

示例9: tokenStream

import com.google.common.collect.Lists; //导入方法依赖的package包/类
private List<TokenHolder> tokenStream() {
    stringFunctionTokenQueue.consumeWhitespace();
    List<TokenHolder> ret = Lists.newLinkedList();
    while (!stringFunctionTokenQueue.isEmpty()) {
        if (stringFunctionTokenQueue.matchesFunction()) {
            ret.add(new TokenHolder(stringFunctionTokenQueue.consumeFunction(), TokenType.Function));
        } else if (stringFunctionTokenQueue.matches("(")) {
            String subExpression = stringFunctionTokenQueue.chompBalanced('(', ')');
            if (subExpression == null) {
                throw new IllegalStateException(
                        "can not parse token :" + stringFunctionTokenQueue.remainder() + " ,unmatched quote");
            }
            ret.add(new TokenHolder(subExpression, TokenType.Expression));
        } else if (stringFunctionTokenQueue.matchesBoolean()) {
            ret.add(new TokenHolder(stringFunctionTokenQueue.consumeWord(), TokenType.Boolean));
        } else if (stringFunctionTokenQueue.matchesAny("+", "-", "*", "/", "%")) {
            char peek = stringFunctionTokenQueue.peek();
            stringFunctionTokenQueue.advance();
            ret.add(new TokenHolder(String.valueOf(peek), TokenType.Operator));
        } else if (stringFunctionTokenQueue.matchesDigit()) {
            ret.add(new TokenHolder(stringFunctionTokenQueue.consumeDigit(), TokenType.Number));
        } else if (stringFunctionTokenQueue.matchesAny('\"', '\'')) {
            String str;
            if (stringFunctionTokenQueue.peek() == '\"') {
                str = stringFunctionTokenQueue.chompBalanced('\"', '\"');
            } else {
                str = stringFunctionTokenQueue.chompBalanced('\'', '\'');
            }
            ret.add(new TokenHolder(StringFunctionTokenQueue.unescape(str), TokenType.String));
        } else {
            throw new IllegalStateException("unknown token:" + stringFunctionTokenQueue.remainder());
        }
        stringFunctionTokenQueue.consumeWhitespace();
    }
    return ret;
}
 
开发者ID:virjar,项目名称:vscrawler,代码行数:37,代码来源:ExpressionParser.java

示例10: index

import com.google.common.collect.Lists; //导入方法依赖的package包/类
@Override
public String index(SpiderInfo spiderInfo) {
    IndexResponse indexResponse;
    if (getByDomain(spiderInfo.getDomain(), 10, 1).size() > 0) {
        List<SpiderInfo> mayDuplicate = Lists.newLinkedList();
        List<SpiderInfo> temp;
        int i = 1;
        do {
            temp = getByDomain(spiderInfo.getDomain(), 100, i++);
            mayDuplicate.addAll(temp);
        } while (temp.size() > 0);
        if (mayDuplicate.indexOf(spiderInfo) != -1 && (spiderInfo = mayDuplicate.get(mayDuplicate.indexOf(spiderInfo))) != null) {
            LOG.warn("已经含有此模板,不再存储");
            return spiderInfo.getId();
        }
    }
    try {
        indexResponse = client.prepareIndex(INDEX_NAME, TYPE_NAME)
                .setSource(gson.toJson(spiderInfo))
                .get();
        LOG.debug("索引爬虫模板成功");
        return indexResponse.getId();
    } catch (Exception e) {
        LOG.error("索引 Webpage 出错," + e.getLocalizedMessage());
    }
    return null;
}
 
开发者ID:bruceq,项目名称:Gather-Platform,代码行数:28,代码来源:SpiderInfoDAO.java

示例11: maakBerichten

import com.google.common.collect.Lists; //导入方法依赖的package包/类
@Override
public List<Mutatiebericht> maakBerichten(final List<Mutatielevering> mutatieleveringen, Mutatiehandeling handeling) throws StapException {
    final ConversieCache conversieCache = new ConversieCache();
    final List<Mutatiebericht> leveringList = Lists.newLinkedList();
    for (final Mutatielevering mutatielevering : mutatieleveringen) {
        if (Stelsel.GBA != mutatielevering.getStelsel()) {
            continue;
        }
        leveringList.addAll(maakBericht(mutatielevering, conversieCache, handeling));
    }
    return leveringList;
}
 
开发者ID:MinBZK,项目名称:OperatieBRP,代码行数:13,代码来源:MaakLo3BerichtServiceImpl.java

示例12: findPath

import com.google.common.collect.Lists; //导入方法依赖的package包/类
private LinkedList<ControlFlowEdge> findPath(Node startNode, Node endNode, Node notVia,
		NextEdgesProvider edgeProvider) {

	if (startNode == endNode) {
		return Lists.newLinkedList();
	}

	LinkedList<LinkedList<ControlFlowEdge>> allPaths = new LinkedList<>();

	// initialization
	List<ControlFlowEdge> nextEdges = edgeProvider.getNextEdges(startNode, ControlFlowType.NonDeadTypes);
	for (ControlFlowEdge nextEdge : nextEdges) {
		LinkedList<ControlFlowEdge> path = new LinkedList<>();
		path.add(nextEdge);
		if (isEndNode(edgeProvider, endNode, nextEdge)) {
			return path; // direct edge from startNode to endNode due to nextEdge
		}
		allPaths.add(path);
	}

	// explore all paths, terminate when endNode is found
	while (!allPaths.isEmpty()) {
		LinkedList<ControlFlowEdge> firstPath = allPaths.removeFirst();
		LinkedList<LinkedList<ControlFlowEdge>> ch = getPaths(edgeProvider, firstPath, notVia);
		for (LinkedList<ControlFlowEdge> chPath : ch) {
			if (isEndNode(edgeProvider, endNode, chPath.getLast())) {
				return chPath;
			}
		}
		allPaths.addAll(ch);
	}

	return null;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:35,代码来源:DirectPathAnalyses.java

示例13: testForLinkedListCreate

import com.google.common.collect.Lists; //导入方法依赖的package包/类
/**
 * 循环10000000次
 * 8841 毫秒
 */
@Test
public void testForLinkedListCreate() {
    Instant start = Instant.now();

    LinkedList<Object> arrayList = Lists.newLinkedList();
    for (int i = 0; i < 10000000; i++) {
        arrayList.add(new Object());
    }

    Instant end = Instant.now();
    long millis = Duration.between(start, end).toMillis();
    System.out.println(millis);
}
 
开发者ID:cbooy,项目名称:cakes,代码行数:18,代码来源:PerformanceTest4Simple.java

示例14: cleanup

import com.google.common.collect.Lists; //导入方法依赖的package包/类
/**
 * For a given host, remove any flow rule which references it's addresses.
 * @param host the host to clean up for
 */
private void cleanup(Host host) {
    Iterable<Device> devices = deviceService.getDevices();
    List<FlowRule> flowRules = Lists.newLinkedList();
    for (Device device : devices) {
           flowRules.addAll(cleanupDevice(device, host));
    }
    FlowRule[] flows = new FlowRule[flowRules.size()];
    flows = flowRules.toArray(flows);
    flowRuleService.removeFlowRules(flows);
}
 
开发者ID:shlee89,项目名称:athena,代码行数:15,代码来源:HostMobility.java

示例15: buildFlowAdd

import com.google.common.collect.Lists; //导入方法依赖的package包/类
@Override
public OFFlowMod buildFlowAdd() {
    Match match = buildMatch();
    List<OFAction> deferredActions = buildActions(treatment.deferred());
    List<OFAction> immediateActions = buildActions(treatment.immediate());
    List<OFInstruction> instructions = Lists.newLinkedList();


    if (treatment.clearedDeferred()) {
        instructions.add(factory().instructions().clearActions());
    }
    if (immediateActions.size() > 0) {
        instructions.add(factory().instructions().applyActions(immediateActions));
    }
    if (deferredActions.size() > 0) {
        instructions.add(factory().instructions().writeActions(deferredActions));
    }
    if (treatment.tableTransition() != null) {
        instructions.add(buildTableGoto(treatment.tableTransition()));
    }
    if (treatment.writeMetadata() != null) {
        instructions.add(buildMetadata(treatment.writeMetadata()));
    }
    if (treatment.metered() != null) {
        instructions.add(buildMeter(treatment.metered()));
    }

    long cookie = flowRule().id().value();

    OFFlowAdd fm = factory().buildFlowAdd()
            .setXid(xid)
            .setCookie(U64.of(cookie))
            .setBufferId(OFBufferId.NO_BUFFER)
            .setInstructions(instructions)
            .setMatch(match)
            .setFlags(Collections.singleton(OFFlowModFlags.SEND_FLOW_REM))
            .setPriority(flowRule().priority())
            .setTableId(TableId.of(flowRule().tableId()))
            .build();

    return fm;
}
 
开发者ID:shlee89,项目名称:athena,代码行数:43,代码来源:FlowModBuilderVer13.java


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