當前位置: 首頁>>代碼示例>>Java>>正文


Java Iterators.addAll方法代碼示例

本文整理匯總了Java中com.google.common.collect.Iterators.addAll方法的典型用法代碼示例。如果您正苦於以下問題:Java Iterators.addAll方法的具體用法?Java Iterators.addAll怎麽用?Java Iterators.addAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.common.collect.Iterators的用法示例。


在下文中一共展示了Iterators.addAll方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onWireCellstoUnfilteredRowIterator

import com.google.common.collect.Iterators; //導入方法依賴的package包/類
public static UnfilteredRowIterator onWireCellstoUnfilteredRowIterator(CFMetaData metadata,
                                                                       DecoratedKey key,
                                                                       LegacyDeletionInfo delInfo,
                                                                       Iterator<LegacyCell> cells,
                                                                       boolean reversed,
                                                                       SerializationHelper helper)
{

    // If the table is a static compact, the "column_metadata" are now internally encoded as
    // static. This has already been recognized by decodeCellName, but it means the cells
    // provided are not in the expected order (the "static" cells are not necessarily at the front).
    // So sort them to make sure toUnfilteredRowIterator works as expected.
    // Further, if the query is reversed, then the on-wire format still has cells in non-reversed
    // order, but we need to have them reverse in the final UnfilteredRowIterator. So reverse them.
    if (metadata.isStaticCompactTable() || reversed)
    {
        List<LegacyCell> l = new ArrayList<>();
        Iterators.addAll(l, cells);
        Collections.sort(l, legacyCellComparator(metadata, reversed));
        cells = l.iterator();
    }

    return toUnfilteredRowIterator(metadata, key, delInfo, cells, reversed, helper);
}
 
開發者ID:Netflix,項目名稱:sstable-adaptor,代碼行數:25,代碼來源:LegacyLayout.java

示例2: constraints_41_AbstractClass

import com.google.common.collect.Iterators; //導入方法依賴的package包/類
/**
 * Constraints 41 (Abstract Class)
 */
private boolean constraints_41_AbstractClass(TClassifier classifier, MemberCube memberCube) {
	List<TMember> abstractMembers = null;
	if (!classifier.isAbstract() && classifier instanceof TClass) {
		for (Entry<NameStaticPair, MemberMatrix> entry : memberCube.entrySet()) {
			MemberMatrix mm = entry.getValue();
			MemberList<TMember> l = new MemberList<>();
			Iterators.addAll(l, mm.actuallyInheritedAndMixedMembers());
			for (SourceAwareIterator iter = mm.actuallyInheritedAndMixedMembers(); iter.hasNext();) {
				TMember m = iter.next();
				if (m.isAbstract()) {
					if (abstractMembers == null) {
						abstractMembers = new ArrayList<>();
					}
					abstractMembers.add(m);
				}
			}
		}
	}
	if (abstractMembers != null) {
		messageMissingImplementations(abstractMembers);
		return false;
	}
	return true;
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:28,代碼來源:N4JSMemberRedefinitionValidator.java

示例3: lineRangesToCharRanges

import com.google.common.collect.Iterators; //導入方法依賴的package包/類
/**
 * Converts zero-indexed, [closed, open) line ranges in the given source file to character ranges.
 */
public static RangeSet<Integer> lineRangesToCharRanges(
        String input, RangeSet<Integer> lineRanges) {
    List<Integer> lines = new ArrayList<>();
    Iterators.addAll(lines, Newlines.lineOffsetIterator(input));
    lines.add(input.length() + 1);

    final RangeSet<Integer> characterRanges = TreeRangeSet.create();
    for (Range<Integer> lineRange :
            lineRanges.subRangeSet(Range.closedOpen(0, lines.size() - 1)).asRanges()) {
        int lineStart = lines.get(lineRange.lowerEndpoint());
        // Exclude the trailing newline. This isn't strictly necessary, but handling blank lines
        // as empty ranges is convenient.
        int lineEnd = lines.get(lineRange.upperEndpoint()) - 1;
        Range<Integer> range = Range.closedOpen(lineStart, lineEnd);
        characterRanges.add(range);
    }
    return characterRanges;
}
 
開發者ID:tranleduy2000,項目名稱:javaide,代碼行數:22,代碼來源:Formatter.java

示例4: testDescendingNavigation

import com.google.common.collect.Iterators; //導入方法依賴的package包/類
@CollectionSize.Require(SEVERAL)
public void testDescendingNavigation() {
  List<Entry<E>> ascending = new ArrayList<Entry<E>>();
  Iterators.addAll(ascending, sortedMultiset.entrySet().iterator());
  List<Entry<E>> descending = new ArrayList<Entry<E>>();
  Iterators.addAll(descending, sortedMultiset.descendingMultiset().entrySet().iterator());
  Collections.reverse(descending);
  assertEquals(ascending, descending);
}
 
開發者ID:zugzug90,項目名稱:guava-mock,代碼行數:10,代碼來源:MultisetNavigationTester.java

示例5: routingValues

import com.google.common.collect.Iterators; //導入方法依賴的package包/類
@Nullable
public Set<String> routingValues(){
    if (clusteredBy.isPresent()) {
        HashSet<String> result = new HashSet<>(clusteredBy.get().size());
        Iterators.addAll(result, Iterators.transform(
                clusteredBy.get().iterator(), ValueSymbolVisitor.STRING.function));
        return result;
    } else {
        return null;
    }
}
 
開發者ID:baidu,項目名稱:Elasticsearch,代碼行數:12,代碼來源:WhereClause.java

示例6: getNonDefaultOptions

import com.google.common.collect.Iterators; //導入方法依賴的package包/類
/**
 * @return all system options that have been set to a non-default value
 */
public OptionList getNonDefaultOptions() {
  Iterator<OptionValue> persistedOptions = Iterators.transform(this.options.getAll(), EXTRACT_OPTIONS);

  OptionList nonDefaultOptions = new OptionList();
  Iterators.addAll(nonDefaultOptions, persistedOptions);
  return nonDefaultOptions;
}
 
開發者ID:dremio,項目名稱:dremio-oss,代碼行數:11,代碼來源:SystemOptionManager.java

示例7: start

import com.google.common.collect.Iterators; //導入方法依賴的package包/類
@Override
public void start(Stage primaryStage) {
    if (primaryStage == null) {
        return;
    }

    DirectoryChooser dirChooser = new DirectoryChooser();
    dirChooser.setTitle("Select CTF trace directory");
    File dir = dirChooser.showDialog(primaryStage);
    if (dir == null) {
        return;
    }

    Path tracePath = dir.toPath();
    CtfTrace trace = new CtfTrace(tracePath);

    // FIXME Reading all events into memory
    List<CtfTraceEvent> events = new ArrayList<>();
    try (TraceIterator<CtfTraceEvent> iter = trace.iterator()) {
        Iterators.addAll(events, iter);
    }

    ObservableList<CtfTraceEvent> eventList = FXCollections.observableList(events);

    /* Setup the filter text field */
    TextField filterField = new TextField();
    FilteredList<CtfTraceEvent> filteredData = new FilteredList<>(eventList, p -> true);
    filterField.textProperty().addListener((observable, oldValue, newValue) -> {
        filteredData.setPredicate(event -> {
            // If filter text is empty, display everything
            if (newValue == null || newValue.isEmpty()) {
                return true;
            }
            if (event.toString().toLowerCase().contains(newValue.toLowerCase())) {
                return true;
            }
            return false;
        });
    });

    /* Setup the table */
    TableColumn<CtfTraceEvent, String> col1 = new TableColumn<>("Timestamp");
    col1.setCellValueFactory(p -> new ReadOnlyObjectWrapper(p.getValue().getTimestamp()));
    col1.setSortable(false);

    TableColumn<CtfTraceEvent, String> col2 = new TableColumn<>("CPU");
    col2.setCellValueFactory(p -> new ReadOnlyObjectWrapper(p.getValue().getCpu()));
    col2.setSortable(false);

    TableColumn<CtfTraceEvent, String> col3 = new TableColumn<>("All");
    col3.setCellValueFactory(p -> new ReadOnlyObjectWrapper(p.getValue().toString()));
    col3.setSortable(false);

    TableView<CtfTraceEvent> tableView = new TableView<>();
    tableView.setFixedCellSize(24);
    tableView.setCache(true);
    tableView.setCacheHint(CacheHint.SPEED);
    tableView.getColumns().addAll(col1, col2, col3);
    tableView.setItems(filteredData);

    /* Setup the full scene */
    Label filterLabel = new Label("Filter:");
    filterLabel.setPadding(new Insets(5));
    HBox filterBox = new HBox(filterLabel, filterField);
    filterBox.setAlignment(Pos.CENTER_LEFT);
    filterBox.setPadding(new Insets(5));

    BorderPane borderPane = new BorderPane();
    borderPane.setTop(filterBox);
    borderPane.setCenter(tableView);

    primaryStage.setScene(new Scene(borderPane, 800, 350));
    primaryStage.setTitle("tableview");
    primaryStage.show();
}
 
開發者ID:lttng,項目名稱:lttng-scope,代碼行數:76,代碼來源:TableViewTesting.java

示例8: matchRecord

import com.google.common.collect.Iterators; //導入方法依賴的package包/類
@VisibleForTesting
MatchType matchRecord(JsonNode objectDatum, Schema schema) {
  boolean partiallyMatchedFields = false;
  Set<String> jsonFields = new HashSet<>();
  Iterators.addAll(jsonFields, objectDatum.fieldNames());

  for (Schema.Field field : schema.getFields()) {
    log.debug("Attempting to match field '{}.{}'...", schema.getName(), field.name());

    if (!objectDatum.has(field.name())) {
      log.debug("Field '{}.{}' not present in JsonNode, considering implicit values...", schema.getName(),
          field.name());
      if (field.defaultVal() != null) {
        log.debug("Absent JSON Field '{}.{}' possibly covered by default: '{}'",
            new Object[] { schema.getName(), field.name(), field.defaultVal() });
        partiallyMatchedFields = true;
      } else if (matches(NullNode.instance, field.schema()) == MatchType.FULL) {
        log.debug("Absent JSON Field '{}.{}' possibly covered by supported null in schema: '{}'",
            new Object[] { schema.getName(), field.name(), field.schema() });
        partiallyMatchedFields = true;
      } else {
        log.debug("Field '{}.{}' missing in JsonNode", schema.getName(), field.name());
        return MatchType.NONE;
      }
    } else {
      MatchType fieldMatchType = matches(objectDatum.get(field.name()), field.schema());
      switch (fieldMatchType) {

      case NONE:
        log.debug("Field '{}.{}' not compatible with JsonNode", schema.getName(), field.name());
        return MatchType.NONE;

      case AMBIGUOUS:
        log.debug("Inconclusive field match with JsonNode for '{}.{}'", schema.getName(), field.name());
        jsonFields.remove(field.name());
        partiallyMatchedFields = true;
        break;

      case FULL:
        log.debug("Located field '{}.{}' in JsonNode", schema.getName(), field.name());
        jsonFields.remove(field.name());
        break;

      default:
        throw new IllegalStateException("Unhandled TypeMatch: " + fieldMatchType);
      }
    }
  }

  if (UndeclaredFieldBehaviour.NO_MATCH == undeclaredFieldBehaviour && !jsonFields.isEmpty()) {
    return MatchType.NONE;
  }

  if (partiallyMatchedFields) {
    log.debug("Inconclusive match for record '{}' to JsonNode.", schema.getName());
    return MatchType.AMBIGUOUS;
  }

  log.debug("Matched record '{}' to JsonNode.", schema.getName());
  return MatchType.FULL;
}
 
開發者ID:HotelsDotCom,項目名稱:jasvorno,代碼行數:62,代碼來源:JasvornoConverter.java

示例9: toArrayList

import com.google.common.collect.Iterators; //導入方法依賴的package包/類
private static <E> ArrayList<E> toArrayList(Collection<E> c) {
  // Avoid calling ArrayList(Collection), which may call back into toArray.
  ArrayList<E> result = new ArrayList<E>(c.size());
  Iterators.addAll(result, c.iterator());
  return result;
}
 
開發者ID:zugzug90,項目名稱:guava-mock,代碼行數:7,代碼來源:LocalCache.java

示例10: getSystemOptions

import com.google.common.collect.Iterators; //導入方法依賴的package包/類
public OptionList getSystemOptions() {
  final OptionList options = new OptionList();
  Iterators.addAll(options, Iterators.filter(iterator(), IS_SYSTEM_OPTION));
  return options;
}
 
開發者ID:dremio,項目名稱:dremio-oss,代碼行數:6,代碼來源:OptionList.java

示例11: getNonSystemOptions

import com.google.common.collect.Iterators; //導入方法依賴的package包/類
public OptionList getNonSystemOptions() {
  final OptionList options = new OptionList();
  Iterators.addAll(options, Iterators.filter(iterator(), Predicates.not(IS_SYSTEM_OPTION)));
  return options;
}
 
開發者ID:dremio,項目名稱:dremio-oss,代碼行數:6,代碼來源:OptionList.java


注:本文中的com.google.common.collect.Iterators.addAll方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。