List of usage examples for com.google.common.collect Lists newLinkedList
@GwtCompatible(serializable = true) public static <E> LinkedList<E> newLinkedList()
From source file:com.calclab.emite.base.util.KeySequencer.java
public KeySequencer() { keyList = Lists.newLinkedList(); }
From source file:com.chiorichan.account.AccountsKeeper.java
public Account accountConstruct(AccountLookupAdapter adapter, String userId, Object... params) throws LoginException { List<Class<?>> paramsClass = Lists.newLinkedList(); for (Object o : params) paramsClass.add(o.getClass());// ww w.ja va 2 s. c o m try { Constructor<? extends Account> constructor = adapter.getAccountClass() .getConstructor(paramsClass.toArray(new Class<?>[0])); return constructor.newInstance(params); } catch (InvocationTargetException e) { throw (LoginException) e.getTargetException(); } catch (NoSuchMethodException | InstantiationException | IllegalAccessException | IllegalArgumentException e) { e.printStackTrace(); AccountManager.getLogger().severe("We had a problem constructing a new instance of '" + adapter.getAccountClass().getCanonicalName() + "' account class. We are not sure of the reason but this is most likely a SEVERE error. For the time being, we constructed a MemoryAccount but this is only temporary and logins will fail."); return new MemoryAccount(userId, AccountLookupAdapter.MEMORY_ADAPTER); } }
From source file:org.richfaces.resource.mapping.PropertiesMappingConfiguration.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 *//*from ww w.j a v a2 s. c om*/ static List<String> getMappingFiles() { List<String> mappingFiles = Lists.newLinkedList(); if (ResourceLoadingOptimizationConfiguration.isEnabled()) { mappingFiles.add(ResourceLoadingOptimizationConfiguration.getResourceLoadingSpecificMappingFile()); } mappingFiles.add(getDefaultMappingFile()); mappingFiles.addAll(getUserConfiguredMappingFile()); return mappingFiles; }
From source file:org.apache.flume.interceptor.InterceptorChain.java
public InterceptorChain() { interceptors = Lists.newLinkedList(); }
From source file:com.twitter.penguin.korean.TwitterKoreanProcessorJava.java
/** * Transforms the tokenization output to List<KoreanTokenJava> * * @param tokens Korean tokens (output of tokenize(CharSequence text)). * @return List of KoreanTokenJava./* www. j a va 2 s. co m*/ */ public static List<KoreanTokenJava> tokensToJavaKoreanTokenList(Seq<KoreanToken> tokens, boolean keepSpace) { Iterator<KoreanToken> tokenized = tokens.iterator(); List<KoreanTokenJava> output = Lists.newLinkedList(); while (tokenized.hasNext()) { KoreanToken token = tokenized.next(); if (keepSpace || token.pos() != KoreanPos.Space()) { output.add(new KoreanTokenJava(token.text(), KoreanPosJava.valueOf(token.pos().toString()), token.offset(), token.length(), token.unknown())); } } return output; }
From source file:com.twitter.common.net.http.handlers.ThreadStackPrinter.java
@Override public Iterable<String> getLines(HttpServletRequest request) { List<String> lines = Lists.newLinkedList(); for (Map.Entry<Thread, StackTraceElement[]> entry : Thread.getAllStackTraces().entrySet()) { Thread t = entry.getKey(); lines.add(String.format("Name: %s\nState: %s\nDaemon: %s\nID: %d", t.getName(), t.getState(), t.isDaemon(), t.getId())); for (StackTraceElement s : entry.getValue()) { lines.add(" " + s.toString()); }/*from ww w.ja va2 s .c o m*/ } return lines; }
From source file:ru.frostman.web.aop.MethodInterceptors.java
public static List<MethodInterceptor> findInterceptors(Map<String, AppClass> classes) { try {/*from ww w .jav a2 s.c om*/ interceptorsCache.clear(); List<MethodInterceptor> methodInterceptors = Lists.newLinkedList(); for (Map.Entry<String, AppClass> entry : classes.entrySet()) { CtClass ctClass = entry.getValue().getCtClass(); for (CtMethod method : EnhancerUtil.getDeclaredMethodsAnnotatedWith(Interceptor.class, ctClass)) { if (EnhancerUtil.isNonPublicAndNonStatic(method)) { throw new AopException("Interceptor method should be public and static"); } String longName = method.getLongName(); if (!method.getReturnType().getName().equals("java.lang.Object")) { throw new AopException("Interceptor method should be void: " + longName); } CtClass[] parameterTypes = method.getParameterTypes(); if (parameterTypes.length != 1 || !parameterTypes[0].getName().equals(METHOD_INVOCATION)) { throw new AopException("Interceptor method should have correct signature: " + longName); } Interceptor interceptorAnn = (Interceptor) method.getAnnotation(Interceptor.class); AopMethodInterceptor interceptor = new AopMethodInterceptor(ctClass.getName(), method.getName(), interceptorAnn.value(), longName); interceptorsCache.put(longName, interceptor); methodInterceptors.add(interceptor); } } for (MethodInterceptor methodInterceptor : JavinPlugins.get().getMethodInterceptors()) { interceptorsCache.put(methodInterceptor.getName(), methodInterceptor); methodInterceptors.add(methodInterceptor); } return methodInterceptors; } catch (Exception e) { throw new JavinRuntimeException("Exception while searching method wrappers", e); } }
From source file:com.google.jstestdriver.coverage.FileCoverage.java
public FileCoverage aggegrate(FileCoverage other) { if (fileId.equals(other.fileId)) { List<CoveredLine> rawLines = Lists.newLinkedList(); rawLines.addAll(lines);//ww w .j a va 2s .co m rawLines.addAll(other.lines); Collections.sort(rawLines); List<CoveredLine> newLines = Lists.newLinkedList(); if (!rawLines.isEmpty()) { CoveredLine current = rawLines.remove(0); for (CoveredLine line : rawLines) { CoveredLine aggregate = current.aggegrate(line); if (aggregate == null) { newLines.add(current); current = line; } else { current = aggregate; } } newLines.add(current); } return new FileCoverage(fileId, newLines); } return null; }
From source file:com.facebook.buck.graph.AbstractBreadthFirstThrowingTraversal.java
public AbstractBreadthFirstThrowingTraversal(Iterable<? extends Node> initialNodes) { toExplore = Lists.newLinkedList(); Iterables.addAll(toExplore, initialNodes); explored = Sets.newHashSet();// www . j av a2 s. co m }
From source file:additionalpipes.pipes.PipeTransportPowerTeleport.java
@Override protected void sendInternalPower() { PipeLogicTeleport logic = ((PipePowerTeleport) container.pipe).getLogic(); List<Pair<PipeTransportPowerTeleport, Float>> powerQueryList = Lists.newLinkedList(); float totalPowerQuery = 0; for (PipePowerTeleport pipe : logic.<PipePowerTeleport>getConnectedPipes(true)) { PipeTransportPowerTeleport target = (PipeTransportPowerTeleport) pipe.transport; float totalQuery = APUtils.sum(target.powerQuery); if (totalQuery > 0) { powerQueryList.add(Pair.of(target, totalQuery)); totalPowerQuery += totalQuery; }/*from w ww . ja v a 2 s . c o m*/ } for (int i = 0; i < 6; i++) { displayPower[i] += displayPower2[i]; displayPower2[i] = 0; float totalWatt = internalPower[i]; if (totalWatt > 0) { for (Pair<PipeTransportPowerTeleport, Float> query : powerQueryList) { float watts = totalWatt / totalPowerQuery * query.getRight(); int energy = MathHelper.ceiling_double_int(watts / AdditionalPipes.unitPower); if (logic.useEnergy(energy)) { PipeTransportPowerTeleport target = query.getLeft(); watts -= target.receiveTeleportedEnergy(watts); displayPower[i] += watts; internalPower[i] -= watts; } } } } super.sendInternalPower(); }