当前位置: 首页>>代码示例>>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;未经允许,请勿转载。