List of usage examples for java.util LinkedList add
public boolean add(E e)
From source file:org.anhonesteffort.flock.sync.SyncWorkerUtil.java
protected static List<List<String>> handlePartitionUidsForReports(List<String> uids) { LinkedList<List<String>> partitionedLists = new LinkedList<List<String>>(); List<String> nextList = new LinkedList<String>(); for (int i = 0; i < uids.size(); i++) { if (i == 0) partitionedLists.add(nextList); else if (i >= MAX_COMPONENTS_PER_REPORT && (i % MAX_COMPONENTS_PER_REPORT) == 0) { nextList = new LinkedList<String>(); partitionedLists.add(nextList); }// w w w .j a v a 2 s .c o m nextList.add(uids.get(i)); } return partitionedLists; }
From source file:de.vandermeer.asciitable.AT_Row.java
/** * Creates a new row with content with given cell context and a normal row style. * @param content the content for the row, each member of the array represents the content for a cell in the row, must not be null but can contain null members * @return a new row with content/*from w ww . j a v a 2s . c o m*/ * @throws {@link NullPointerException} if content was null */ public static AT_Row createContentRow(Object[] content, TableRowStyle style) { Validate.notNull(content); Validate.notNull(style); Validate.validState(style != TableRowStyle.UNKNOWN); LinkedList<AT_Cell> cells = new LinkedList<AT_Cell>(); for (Object o : content) { cells.add(new AT_Cell(o)); } return new AT_Row() { @Override public TableRowType getType() { return TableRowType.CONTENT; } @Override public TableRowStyle getStyle() { return style; } @Override public LinkedList<AT_Cell> getCells() { return cells; } }; }
From source file:gr.abiss.calipso.tiers.specifications.GenericSpecifications.java
/** * Add a predicate to the given list if valid * @param clazz the entity type to query for * @param root the criteria root/*from ww w . j a v a 2 s . c o m*/ * @param cb the criteria builder * @param predicates the list to add the predicate into * @param propertyValues the predicate values * @param propertyName the predicate name */ protected static void addPredicate(final Class clazz, Root<Persistable> root, CriteriaBuilder cb, LinkedList<Predicate> predicates, String[] propertyValues, String propertyName) { // dot notation only supports toOne.toOne.id if (propertyName.contains(".")) { predicates .add(anyToOneToOnePredicateFactory.getPredicate(root, cb, propertyName, null, propertyValues)); } else {// normal single step predicate Field field = GenericSpecifications.getField(clazz, propertyName); if (field != null) { Class fieldType = field.getType(); IPredicateFactory predicateFactory = getPredicateFactoryForClass(field); if (predicateFactory != null) { predicates .add(predicateFactory.getPredicate(root, cb, propertyName, fieldType, propertyValues)); } } } }
From source file:org.dswarm.common.model.util.AttributePathUtil.java
public static Optional<AttributePath> determineCommonAttributePath(final ContentSchema contentSchema) { if (contentSchema.getKeyAttributePaths() == null && contentSchema.getValueAttributePath() == null) { return Optional.absent(); }/*from w ww . j a v a 2s . c o m*/ final Map<String, AttributePath> attributePaths = new HashMap<>(); final Map<String, Attribute> attributes = new HashMap<>(); if (contentSchema.getKeyAttributePaths() != null) { for (final AttributePath attributePath : contentSchema.getKeyAttributePaths()) { fillMaps(attributePath, attributePaths, attributes); } } if (contentSchema.getValueAttributePath() != null) { fillMaps(contentSchema.getValueAttributePath(), attributePaths, attributes); } final String commonPrefix = StringUtils .getCommonPrefix(attributePaths.keySet().toArray(new String[attributePaths.size()])); final String commonAttributePathString = cleanCommonPrefix(commonPrefix); if (attributePaths.containsKey(commonAttributePathString)) { return Optional.fromNullable(attributePaths.get(commonAttributePathString)); } final String[] attributeURIs = commonAttributePathString.split(DMPStatics.ATTRIBUTE_DELIMITER.toString()); final LinkedList<Attribute> apAttributes = new LinkedList<>(); for (final String attributeURI : attributeURIs) { final Attribute attribute = attributes.get(attributeURI); apAttributes.add(attribute); } return Optional.of(new AttributePath(apAttributes)); }
From source file:se.trillian.goodies.spring.DomainObjectFactoryFactoryBean.java
private static Constructor<?> findMatchingConstructor(Class<?> clazz, Method m) { LinkedList<Constructor<?>> constructors = new LinkedList<Constructor<?>>(); Constructor<?> directMatch = null; for (Constructor<?> c : clazz.getDeclaredConstructors()) { if (isParameterTypesPrefix(m.getParameterTypes(), c.getParameterTypes())) { constructors.add(c); if (directMatch == null && isParameterTypesPrefix(c.getParameterTypes(), m.getParameterTypes())) { directMatch = c;// w w w.ja va2s.c om } } } if (constructors.isEmpty()) { throw new IllegalArgumentException("No matching constructor found in " + "implementation class '" + clazz + "' for factory method '" + m + "'"); } if (constructors.size() > 1) { if (directMatch != null) { return directMatch; } throw new IllegalArgumentException("More than 1 matching constructor " + "found in implementation class '" + clazz + "' for factory method '" + m + "'"); } return constructors.getFirst(); }
From source file:eu.stratosphere.pact.test.pactPrograms.TPCHQuery10ITCase.java
@Parameters public static Collection<Object[]> getConfigurations() { LinkedList<Configuration> tConfigs = new LinkedList<Configuration>(); Configuration config = new Configuration(); config.setInteger("TPCHQuery10Test#NoSubtasks", 4); tConfigs.add(config); return toParameterList(tConfigs); }
From source file:org.androidappdev.codebits.CodebitsApi.java
/** * List submissions/*from www .j av a 2 s. c o m*/ * * @param token * authentication token * @return Returns the list of the call for talks submissions for this year. * @throws JSONException */ public static List<Talk> listSubmissions(String token) { LinkedList<Talk> result = new LinkedList<Talk>(); try { String url = "https://services.sapo.pt/Codebits/calltalks"; if (token != null) { url += "?token=" + token; } JSONArray jsonArray = new JSONArray(performHttpRequest(url)); for (int i = 0; i < jsonArray.length(); i++) { result.add(new Talk(jsonArray.getJSONObject(i))); } } catch (JSONException e) { Log.d(TAG, "JSONException", e); } return result; }
From source file:com.cyclopsgroup.waterview.utils.TagSupportBase.java
/** * Set the resource for script//from w ww . j a va 2s. co m * * @param resource Resource of script * @param context Context to set */ public static final void addScriptResource(URL resource, JellyContext context) { synchronized (context) { LinkedList scriptResources = (LinkedList) context.getVariable(SCRIPT_RESOURCE_NAME); if (scriptResources == null) { scriptResources = new LinkedList(); context.setVariable(SCRIPT_RESOURCE_NAME, scriptResources); } scriptResources.add(resource); } }
From source file:com.machinepublishers.jbrowserdriver.LogsServer.java
private static void handleMessage(String message, LinkedList<Entry> entries, Level level, String type, Settings settings) {// w ww .j ava2s . c o m if (settings != null && settings.logsMax() > 0) { final Entry entry = new Entry(level, System.currentTimeMillis(), message); synchronized (entries) { entries.add(entry); if (entries.size() > settings.logsMax()) { entries.removeFirst(); } } } if (settings == null || level.intValue() >= settings.loggerLevel()) { System.err.println(">" + level.getName() + "/" + type + "/" + message); } }
From source file:org.dswarm.common.model.util.AttributePathUtil.java
public static AttributePath parseAttributePathString(final String attributePathString, final Map<String, Attribute> attributeMap, final Map<String, AttributePath> attributePathMap) { final String[] attributes = attributePathString.split(DMPStatics.ATTRIBUTE_DELIMITER.toString()); if (attributes.length <= 0) { return null; }//from w w w .j a va 2 s. co m final LinkedList<Attribute> attributeList = new LinkedList<>(); for (final String attributeURI : attributes) { final Attribute attribute = getOrCreateAttribute(attributeURI, Optional.fromNullable(attributeMap)); attributeList.add(attribute); } return getOrCreateAttributePath(attributeList, Optional.fromNullable(attributePathMap)); }