List of usage examples for com.google.common.collect Lists newLinkedList
@GwtCompatible(serializable = true) public static <E> LinkedList<E> newLinkedList()
From source file:ru.frostman.web.secure.inject.SecureSupport.java
private static void buildUserDetailsInjection(List<InjectionRule> injectionRules, UserServiceProvider provider) {/*from ww w. ja v a 2s .com*/ List<String> classNames = Lists.newLinkedList(); classNames.add(UserDetails.class.getName()); classNames.add(provider.getUserDetailsClass().getName()); InjectionRule rule = new BaseInjection(Lists.<String>newLinkedList(), classNames, "", SECURITY_MANAGER_GET + ".getUserService().extract(request, response)", ""); injectionRules.add(rule); }
From source file:org.eclipse.xtext.xbase.typesystem.internal.AbstractAmbiguousLinkingCandidate.java
protected AbstractAmbiguousLinkingCandidate(Candidate first, AbstractPendingLinkingCandidate<?> second) { this.candidates = Lists.newLinkedList(); addCandidate(first); addCandidate(second); }
From source file:com.github.kryptohash.kryptohashj.wallet.KeyTimeCoinSelector.java
@Override public CoinSelection select(Coin target, List<TransactionOutput> candidates) { try {//from w w w.ja v a2s . c om LinkedList<TransactionOutput> gathered = Lists.newLinkedList(); Coin valueGathered = Coin.ZERO; for (TransactionOutput output : candidates) { if (ignorePending && !isConfirmed(output)) continue; // Find the key that controls output, assuming it's a regular pay-to-pubkey or pay-to-address output. // We ignore any other kind of exotic output on the assumption we can't spend it ourselves. final Script scriptPubKey = output.getScriptPubKey(); Ed25519Key controllingKey; if (scriptPubKey.isSentToRawPubKey()) { controllingKey = wallet.findKeyFromPubKey(scriptPubKey.getPubKey()); } else if (scriptPubKey.isSentToAddress()) { controllingKey = wallet.findKeyFromPubHash(scriptPubKey.getPubKeyHash()); } else { log.info("Skipping tx output {} because it's not of simple form.", output); continue; } checkNotNull(controllingKey, "Coin selector given output as candidate for which we lack the key"); if (controllingKey.getCreationTimeSeconds() >= unixTimeSeconds) continue; // It's older than the cutoff time so select. valueGathered = valueGathered.add(output.getValue()); gathered.push(output); if (gathered.size() >= MAX_SIMULTANEOUS_INPUTS) { log.warn("Reached {} inputs, going further would yield a tx that is too large, stopping here.", gathered.size()); break; } } return new CoinSelection(valueGathered, gathered); } catch (ScriptException e) { throw new RuntimeException(e); // We should never have problems understanding scripts in our wallet. } }
From source file:org.illalabs.rss.SyndEntrySerializer.java
public List<ObjectNode> deserializeAll(Collection<SyndEntry> entries) { List<ObjectNode> result = Lists.newLinkedList(); for (SyndEntry entry : entries) { result.add(deserialize(entry));/*from www . j av a2 s.c o m*/ } return result; }
From source file:org.impressivecode.depress.mr.pitest.PitestEntriesParser.java
public List<PitestEntry> parseEntries(final String path) throws ParserConfigurationException, SAXException, IOException { Preconditions.checkArgument(!isNullOrEmpty(path), "Path has to be set."); DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document doc = dBuilder.parse(path); NodeList nList = getSourceFileNodes(doc); DecimalFormat df = new DecimalFormat("#.##"); int size = nList.getLength(); List<PitestEntry> pitestEntries = Lists.newLinkedList(); for (int i = 0; i < size; i++) { Node item = nList.item(i); PitestEntry entry = parse(item); pitestEntries.add(entry);/* w w w.j a v a2s .c o m*/ } for (int i = 0; i < pitestEntries.size(); i++) { int mutations = 1; int passed_mutations = 0; PitestEntry elem = pitestEntries.get(i); if (elem.getDetection() == true) passed_mutations++; for (int j = i + 1; j < pitestEntries.size(); j++) { PitestEntry elem1 = pitestEntries.get(j); if (elem.getMutatedClass().equals(elem1.getMutatedClass())) { if (elem1.getDetection() == true) { passed_mutations++; } mutations++; pitestEntries.remove(elem1); j--; } } if (mutations != 0) elem.setMutationScoreIndicator(Double .valueOf((df.format((double) passed_mutations / (double) mutations)).replaceAll(",", "."))); else elem.setMutationScoreIndicator(0.00); } return pitestEntries; }
From source file:org.dishevelled.bio.range.tree.RangeList.java
@Override public Iterable<Range<C>> intersect(final Range<C> query) { checkNotNull(query);//from w w w . j a v a 2s.c o m List<Range<C>> result = Lists.newLinkedList(); for (Range<C> range : ranges) { if (Ranges.intersect(range, query)) { result.add(range); } } return result; }
From source file:org.gradle.api.internal.initialization.ClassLoaderScopeIdentifier.java
private String getPath() { List<String> names = Lists.newLinkedList(); names.add(name);// w w w. j a v a 2 s . c om ClassLoaderScopeIdentifier nextParent = parent; while (nextParent != null) { names.add(0, nextParent.name); nextParent = nextParent.parent; } return Joiner.on(":").join(names); }
From source file:org.apache.tez.mapreduce.processor.SimpleMRProcessor.java
@Override protected void postOp() throws Exception { if (getOutputs() == null) { return; // No post op }//from w w w. ja va 2 s . co m List<MROutput> mrOuts = Lists.newLinkedList(); for (LogicalOutput output : getOutputs().values()) { if (output instanceof MROutput) { MROutput mrOutput = (MROutput) output; mrOutput.flush(); if (mrOutput.isCommitRequired()) { mrOuts.add((MROutput) output); } } } if (mrOuts.size() > 0) { // This will loop till the AM asks for the task to be killed. As // against, the AM sending a signal to the task to kill itself // gracefully. The AM waits for the current committer to successfully // complete and then kills us. Until then we wait in case the // current committer fails and we get chosen to commit. while (!getContext().canCommit()) { Thread.sleep(100); } boolean willAbort = false; Exception savedEx = null; for (MROutput output : mrOuts) { try { output.commit(); } catch (IOException ioe) { LOG.warn("Error in committing output", ioe); willAbort = true; savedEx = ioe; break; } } if (willAbort == true) { for (MROutput output : mrOuts) { try { output.abort(); } catch (IOException ioe) { LOG.warn("Error in aborting output", ioe); } } throw savedEx; } } }
From source file:org.apache.streams.datasift.processor.DatasiftActivitySerializerProcessor.java
@Override public List<StreamsDatum> process(StreamsDatum entry) { List<StreamsDatum> result = Lists.newLinkedList(); Activity activity;/*from www . j a va 2 s . c om*/ try { Datasift node; if (entry.getDocument() instanceof String) { node = this.mapper.readValue((String) entry.getDocument(), Datasift.class); } else if (entry.getDocument() instanceof Datasift) { node = (Datasift) entry.getDocument(); } else { node = this.mapper.convertValue(entry.getDocument(), Datasift.class); } if (node != null) { activity = this.datasiftActivitySerializer.deserialize(node); StreamsDatum datum = new StreamsDatum(activity, entry.getId(), entry.getTimestamp(), entry.getSequenceid()); datum.setMetadata(entry.getMetadata()); result.add(datum); } } catch (Exception e) { LOGGER.error("Exception converting Datasift Interaction to " + this.outClass.getName() + " : {}", e); } return result; }
From source file:org.impressivecode.depress.mr.checkstyle.CheckStyleEntriesParser.java
public List<CheckStyleEntry> parseEntries(final String path) throws ParserConfigurationException, SAXException, IOException { Preconditions.checkArgument(!isNullOrEmpty(path), "Path has to be set."); DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document doc = dBuilder.parse(path); NodeList nList = getSourceFileNodes(doc); int size = nList.getLength(); List<CheckStyleEntry> checkstyleEntries = Lists.newLinkedList(); for (int i = 0; i < size; i++) { Node item = nList.item(i); if (!isJavaFile(item)) { continue; }// w w w .j a v a 2s . c om NodeList cNodes = item.getChildNodes(); processEntries(checkstyleEntries, cNodes); } return checkstyleEntries; }