List of usage examples for com.google.common.collect Iterables addAll
public static <T> boolean addAll(Collection<T> addTo, Iterable<? extends T> elementsToAdd)
From source file:org.jclouds.vcloud.domain.ovf.VirtualSystem.java
public VirtualSystem(String id, String info, String name, OperatingSystemSection operatingSystem, Iterable<? extends VirtualHardwareSection> hardware) { this.id = id; this.info = info; this.name = name; this.operatingSystem = checkNotNull(operatingSystem, "operatingSystem"); Iterables.addAll(this.hardware, checkNotNull(hardware, "hardware")); }
From source file:org.renjin.primitives.io.DebianControlFiles.java
/** * Internal primitive used by the read.dcf() function in the base library. * /* ww w. j a v a2s. com*/ * @param conn * @param fields a list of fields to return or NULL for all fields * @param keepWhiteSpace * @return * @throws IOException */ @Internal public static SEXP readDCF(@Current Context context, SEXP conn, Vector requestedFields, boolean keepWhiteSpace) throws IOException { Map<Cell, String> cells = Maps.newHashMap(); List<String> fields = Lists.newArrayList(); // if specific fields are requested, the fields parameter // dictates the order boolean allFields = true; if (requestedFields instanceof StringVector) { Iterables.addAll(fields, (StringVector) requestedFields); allFields = false; } int rowIndex = 0; boolean lastLineWasBlank = false; String line; PushbackBufferedReader reader = Connections.getConnection(context, conn).getReader(); Cell lastCell = null; while ((line = reader.readLine()) != null) { boolean lineIsBlank = line.trim().length() == 0; if (lineIsBlank) { if (!lastLineWasBlank) { rowIndex++; } lastCell = null; } else if (isContinuation(line)) { if (lastCell == null) { throw new EvalException("Malformed DCF exception '%s'", line); } else { StringBuilder value = new StringBuilder(); value.append(cells.get(lastCell)); value.append(" "); value.append(line.trim()); cells.put(lastCell, value.toString()); } } else { String[] fieldValue = parseLine(line); String fieldName = fieldValue[0]; boolean includeValue = false; if (fields.contains(fieldName)) { includeValue = true; } else if (allFields) { fields.add(fieldName); includeValue = true; } Cell cell = new Cell(rowIndex, fieldName); if (includeValue) { cells.put(cell, fieldValue[1]); } lastCell = cell; } lastLineWasBlank = lineIsBlank; } int numRows = rowIndex; if (!lastLineWasBlank) { numRows++; } return constructMatrix(numRows, cells, fields); }
From source file:org.jboss.hal.core.mbui.form.ExactlyOneAlternativeValidation.java
ExactlyOneAlternativeValidation(final Iterable<String> requiredAlternatives, final Constants constants, final Messages messages) { this.requiredAlternatives = new TreeSet<>(); Iterables.addAll(this.requiredAlternatives, requiredAlternatives); this.constants = constants; this.messages = messages; }
From source file:com.android.ide.eclipse.adt.internal.editors.layout.ActionBarHandler.java
@Override public List<String> getMenuIdNames() { String commaSeparatedMenus = getXmlAttribute(ATTR_MENU); List<String> menus = new ArrayList<String>(); Iterables.addAll(menus, Splitter.on(',').trimResults().omitEmptyStrings().split(commaSeparatedMenus)); return menus; }
From source file:com.zimbra.soap.admin.message.GetGrantsResponse.java
public void setGrants(Iterable<GrantInfo> grants) { this.grants.clear(); if (grants != null) { Iterables.addAll(this.grants, grants); }/*from w ww .j a v a 2 s . co m*/ }
From source file:com.zimbra.soap.mail.type.ConflictRecurrenceInstance.java
public void setFreebusyUsers(Iterable<FreeBusyUserStatus> freebusyUsers) { this.freebusyUsers.clear(); if (freebusyUsers != null) { Iterables.addAll(this.freebusyUsers, freebusyUsers); }// w ww . j a v a 2s. co m }
From source file:org.jboss.weld.executor.IterativeWorkerTaskFactory.java
public IterativeWorkerTaskFactory(Iterable<? extends T> iterable) { this.queue = new ConcurrentLinkedQueue<T>(); Iterables.addAll(queue, iterable); }
From source file:org.jboss.hal.core.mbui.form.NotMoreThanOneAlternativeValidation.java
NotMoreThanOneAlternativeValidation(Iterable<String> alternatives, ModelNodeForm<T> form, Constants constants, Messages messages) {//from www .j av a 2s . c om this.alternatives = new TreeSet<>(); Iterables.addAll(this.alternatives, alternatives); this.form = form; this.constants = constants; this.messages = messages; }
From source file:com.zimbra.soap.mail.message.GetTagResponse.java
public void setTags(Iterable<TagInfo> tags) { this.tags.clear(); if (tags != null) { Iterables.addAll(this.tags, tags); }// www . j ava 2 s . co m }
From source file:com.zimbra.soap.account.message.GetAvailableSkinsResponse.java
public void setSkins(Iterable<NamedElement> skins) { this.skins.clear(); if (skins != null) { Iterables.addAll(this.skins, skins); }/*from ww w .ja v a 2 s . c om*/ }