本文整理汇总了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);
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
}
示例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;
}
示例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();
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}