List of usage examples for com.google.common.collect Lists newLinkedList
@GwtCompatible(serializable = true) public static <E> LinkedList<E> newLinkedList()
From source file:org.opendaylight.protocol.util.PCEPHexDumpParser.java
private static List<byte[]> parseMessages(final String c) { final String content = clearWhiteSpaceToUpper(c); final List<byte[]> messages = Lists.newLinkedList(); int idx = content.indexOf(LENGTH, 0); while (idx > -1) { // next chars are final length, ending with '.' final int lengthIdx = idx + LENGTH.length(); final int messageIdx = content.indexOf('.', lengthIdx); final int length = Integer.parseInt(content.substring(lengthIdx, messageIdx)); // dot//from w ww.j av a 2 s . c o m final int messageEndIdx = messageIdx + (length * 2) + 1; // Assert that message is longer than minimum 4(header.length == 4) // If length in PCEP message would be 0, loop would never end Preconditions.checkArgument(length >= MINIMAL_LENGTH, "Invalid message at index " + idx + ", length atribute is lower than " + MINIMAL_LENGTH); // dot final String hexMessage = content.substring(messageIdx + 1, messageEndIdx); final byte[] message = BaseEncoding.base16().decode(hexMessage); messages.add(message); idx = messageEndIdx; idx = content.indexOf(LENGTH, idx); } LOG.info("Succesfully extracted {} messages", messages.size()); return messages; }
From source file:exec.examples.IoHelper.java
public static List<String> findAllZips(String dir) { List<String> zips = Lists.newLinkedList(); for (File f : FileUtils.listFiles(new File(dir), new String[] { "zip" }, true)) { zips.add(f.getAbsolutePath());/*w w w.j a va2s .c om*/ } return zips; }
From source file:additionalpipes.triggers.PipeTriggerProvider.java
@Override public LinkedList<ITrigger> getPipeTriggers(IPipe ipipe) { Pipe<?> pipe = (Pipe<?>) ipipe; LinkedList<ITrigger> result = Lists.newLinkedList(); if (pipe instanceof PipePowerAdvancedWood) { result.add(BuildCraftTransport.triggerPipeRequestsEnergy); } else if (pipe instanceof ITeleportLogicProvider && pipe.hasGate()) { if (/*pipe.wireSet[IPipe.WireColor.Red.ordinal()] && */pipe.gate.kind.ordinal() >= Gate.GateKind.AND_2 .ordinal()) {/*from w w w .ja v a2 s . c o m*/ result.add(AdditionalPipes.triggerRemoteRedSignalActive); result.add(AdditionalPipes.triggerRemoteRedSignalInactive); } if (/*pipe.wireSet[IPipe.WireColor.Blue.ordinal()] && */pipe.gate.kind.ordinal() >= Gate.GateKind.AND_3 .ordinal()) { result.add(AdditionalPipes.triggerRemoteBlueSignalActive); result.add(AdditionalPipes.triggerRemoteBlueSignalInactive); } if (/*pipe.wireSet[IPipe.WireColor.Green.ordinal()] && */pipe.gate.kind.ordinal() >= Gate.GateKind.AND_4 .ordinal()) { result.add(AdditionalPipes.triggerRemoteGreenSignalActive); result.add(AdditionalPipes.triggerRemoteGreenSignalInactive); } if (/*pipe.wireSet[IPipe.WireColor.Yellow.ordinal()] && */pipe.gate.kind .ordinal() >= Gate.GateKind.AND_4.ordinal()) { result.add(AdditionalPipes.triggerRemoteYellowSignalActive); result.add(AdditionalPipes.triggerRemoteYellowSignalInactive); } } return result; }
From source file:test.BoundedGenericModule.java
private static <E> LinkedList<E> newLinkedList(E... elements) { LinkedList<E> list = Lists.newLinkedList(); Collections.addAll(list, elements); return list;// w w w. j a va 2 s . c om }
From source file:ru.frostman.web.classloading.enhance.SecurityEnhancer.java
public static void enhance(CtClass ctClass) { for (CtMethod method : EnhancerUtil.getDeclaredMethodsAnnotatedWith(Secure.class, ctClass)) { try {//from w w w .j ava 2 s .com Secure secureAnnotation = (Secure) method.getAnnotation(Secure.class); List<String> paramClasses = Lists.newLinkedList(); for (CtClass paramCtClass : method.getParameterTypes()) { paramClasses.add(paramCtClass.getName()); } int expressionId = Javin.getClasses().getSecurityManager() .registerExpression(secureAnnotation.value(), paramClasses); method.insertBefore("{" + Javin.class.getName() + ".getClasses().getSecurityManager().check(" + ctClass.getName() + ".class, " + "\"" + method.getName() + "\", " + expressionId + ", $args);}"); } catch (Exception e) { throw new BytecodeManipulationException("Error in enhancing @Secure method", e); } } }
From source file:com.pradeep.blackjack.deck.Deck.java
public Deck() { this.cards = Lists.newLinkedList(); for (Suit suit : Suit.values()) { for (int i = 1; i < 14; i++) { this.cards.add(CardFactory.newCard(suit, i)); }// w w w . jav a 2 s .c o m } }
From source file:org.richfaces.resource.ResourceMappingFeature.java
/** * Returns locations of static resource mapping configuration files for current application stage. * * @return locations of static resource mapping configuration files for current application stage *//* ww w . ja va 2 s.co m*/ public static List<String> getMappingFiles() { List<String> mappingFiles = Lists.newLinkedList(); if (ResourceLoadingOptimization.isEnabled()) { mappingFiles.add(ResourceLoadingOptimization.getResourceLoadingSpecificMappingFile()); } mappingFiles.add(getDefaultMappingFile()); mappingFiles.addAll(getUserConfiguredMappingFile()); return mappingFiles; }
From source file:io.knotx.splitter.impl.HtmlFragmentSplitter.java
@Override public List<Fragment> split(String html) { List<Fragment> fragments = Lists.newLinkedList(); if (html.matches(FragmentConstants.ANY_SNIPPET_PATTERN)) { Matcher matcher = FragmentConstants.SNIPPET_PATTERN.matcher(html); int idx = 0; while (matcher.find()) { MatchResult matchResult = matcher.toMatchResult(); if (idx < matchResult.start()) { fragments.add(toRaw(html, idx, matchResult.start())); }// w ww . ja va2 s . c om fragments.add(toSnippet( matchResult.group(1).intern().split(FragmentConstants.FRAGMENT_IDENTIFIERS_SEPARATOR), html, matchResult.start(), matchResult.end())); idx = matchResult.end(); } if (idx < html.length()) { fragments.add(toRaw(html, idx, html.length())); } } else { fragments.add(toRaw(html, 0, html.length())); } return fragments; }
From source file:com.cloudera.crunch.impl.mr.plan.NodePath.java
public NodePath(PCollectionImpl tail) { this.path = Lists.newLinkedList(); this.path.add(tail); }
From source file:integration.PerfectResultsIfOnlyEqualInputIsUsed.java
@Override public List<Usage> getValidationData() { List<Usage> usages = Lists.newLinkedList(); usages.add(createUsage()); return usages; }