本文整理了Java中org.apache.calcite.linq4j.Enumerable.into()
方法的一些代码示例,展示了Enumerable.into()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Enumerable.into()
方法的具体详情如下:
包路径:org.apache.calcite.linq4j.Enumerable
类名称:Enumerable
方法名:into
暂无
代码示例来源:origin: org.apache.calcite/calcite-linq4j
/** Default implementation of {@link ExtendedEnumerable#removeAll(Collection)}. */
public static <T, C extends Collection<? super T>> C remove(
Enumerable<T> source, C sink) {
List<T> tempList = new ArrayList<>();
source.into(tempList);
sink.removeAll(tempList);
return sink;
}
代码示例来源:origin: org.apache.calcite/calcite-linq4j
/**
* Produces the set union of two sequences by using
* the default equality comparer.
*/
public static <TSource> Enumerable<TSource> union(Enumerable<TSource> source0,
Enumerable<TSource> source1) {
Set<TSource> set = new HashSet<>();
source0.into(set);
source1.into(set);
return Linq4j.asEnumerable(set);
}
代码示例来源:origin: org.apache.calcite/calcite-linq4j
/**
* Creates a {@code List<TSource>} from an {@code Enumerable<TSource>}.
*/
@SuppressWarnings("unchecked")
public static <TSource> List<TSource> toList(Enumerable<TSource> source) {
if (source instanceof List && source instanceof RandomAccess) {
return (List<TSource>) source;
} else {
return source.into(
source instanceof Collection
? new ArrayList<>(((Collection) source).size())
: new ArrayList<>());
}
}
代码示例来源:origin: org.apache.calcite/calcite-linq4j
/**
* Produces the set intersection of two sequences by
* using the default equality comparer to compare values. (Defined
* by Enumerable.)
*/
public static <TSource> Enumerable<TSource> intersect(
Enumerable<TSource> source0, Enumerable<TSource> source1) {
Set<TSource> set0 = new HashSet<>();
source0.into(set0);
Set<TSource> set1 = new HashSet<>();
try (Enumerator<TSource> os = source1.enumerator()) {
while (os.moveNext()) {
TSource o = os.current();
if (set0.contains(o)) {
set1.add(o);
}
}
}
return Linq4j.asEnumerable(set1);
}
代码示例来源:origin: Qihoo360/Quicksql
CatalogScope(SqlValidatorScope parent, List<String> names) {
super(parent);
this.names = ImmutableList.copyOf(names);
this.schemaNames =
Linq4j.asEnumerable(
validator.getCatalogReader()
.getAllSchemaObjectNames(ImmutableList.of()))
.where(input -> input.getType() == SqlMonikerType.SCHEMA)
.select(SqlMoniker::getFullyQualifiedNames)
.into(new HashSet<>());
}
代码示例来源:origin: org.apache.calcite/calcite-core
CatalogScope(SqlValidatorScope parent, List<String> names) {
super(parent);
this.names = ImmutableList.copyOf(names);
this.schemaNames =
Linq4j.asEnumerable(
validator.getCatalogReader()
.getAllSchemaObjectNames(ImmutableList.of()))
.where(input -> input.getType() == SqlMonikerType.SCHEMA)
.select(SqlMoniker::getFullyQualifiedNames)
.into(new HashSet<>());
}
代码示例来源:origin: org.apache.calcite/calcite-linq4j
/**
* Produces the set difference of two sequences by
* using the default equality comparer to compare values. (Defined
* by Enumerable.)
*/
public static <TSource> Enumerable<TSource> except(
Enumerable<TSource> source0, Enumerable<TSource> source1) {
Set<TSource> set = new HashSet<>();
source0.into(set);
try (Enumerator<TSource> os = source1.enumerator()) {
while (os.moveNext()) {
TSource o = os.current();
set.remove(o);
}
return Linq4j.asEnumerable(set);
}
}
代码示例来源:origin: Qihoo360/Quicksql
/** Creates a column loader, and performs the load.
*
* @param typeFactory Type factory
* @param sourceTable Source data
* @param protoRowType Logical row type
* @param repList Physical row types, or null if not known */
ColumnLoader(JavaTypeFactory typeFactory,
Enumerable<T> sourceTable,
RelProtoDataType protoRowType,
List<ColumnMetaData.Rep> repList) {
this.typeFactory = typeFactory;
final RelDataType rowType = protoRowType.apply(typeFactory);
if (repList == null) {
repList =
Collections.nCopies(rowType.getFieldCount(),
ColumnMetaData.Rep.OBJECT);
}
sourceTable.into(list);
final int[] sorts = {-1};
load(rowType, repList, sorts);
this.sortField = sorts[0];
}
代码示例来源:origin: org.apache.calcite/calcite-core
/** Creates a column loader, and performs the load.
*
* @param typeFactory Type factory
* @param sourceTable Source data
* @param protoRowType Logical row type
* @param repList Physical row types, or null if not known */
ColumnLoader(JavaTypeFactory typeFactory,
Enumerable<T> sourceTable,
RelProtoDataType protoRowType,
List<ColumnMetaData.Rep> repList) {
this.typeFactory = typeFactory;
final RelDataType rowType = protoRowType.apply(typeFactory);
if (repList == null) {
repList =
Collections.nCopies(rowType.getFieldCount(),
ColumnMetaData.Rep.OBJECT);
}
sourceTable.into(list);
final int[] sorts = {-1};
load(rowType, repList, sorts);
this.sortField = sorts[0];
}
代码示例来源:origin: org.apache.calcite/calcite-linq4j
/**
* Produces the set union of two sequences by using a
* specified EqualityComparer<TSource>.
*/
public static <TSource> Enumerable<TSource> union(Enumerable<TSource> source0,
Enumerable<TSource> source1, final EqualityComparer<TSource> comparer) {
if (comparer == Functions.identityComparer()) {
return union(source0, source1);
}
Set<Wrapped<TSource>> set = new HashSet<>();
Function1<TSource, Wrapped<TSource>> wrapper = wrapperFor(comparer);
Function1<Wrapped<TSource>, TSource> unwrapper = unwrapper();
source0.select(wrapper).into(set);
source1.select(wrapper).into(set);
return Linq4j.asEnumerable(set).select(unwrapper);
}
代码示例来源:origin: org.apache.calcite/calcite-linq4j
/**
* Returns distinct elements from a sequence by using
* a specified {@link EqualityComparer} to compare values.
*/
public static <TSource> Enumerable<TSource> distinct(
Enumerable<TSource> enumerable, EqualityComparer<TSource> comparer) {
if (comparer == Functions.identityComparer()) {
return distinct(enumerable);
}
final Set<Wrapped<TSource>> set = new HashSet<>();
Function1<TSource, Wrapped<TSource>> wrapper = wrapperFor(comparer);
Function1<Wrapped<TSource>, TSource> unwrapper = unwrapper();
enumerable.select(wrapper).into(set);
return Linq4j.asEnumerable(set).select(unwrapper);
}
代码示例来源:origin: org.apache.calcite/calcite-linq4j
/**
* Produces the set intersection of two sequences by
* using the specified {@code EqualityComparer<TSource>} to compare
* values.
*/
public static <TSource> Enumerable<TSource> intersect(
Enumerable<TSource> source0, Enumerable<TSource> source1,
EqualityComparer<TSource> comparer) {
if (comparer == Functions.identityComparer()) {
return intersect(source0, source1);
}
Set<Wrapped<TSource>> set0 = new HashSet<>();
Function1<TSource, Wrapped<TSource>> wrapper = wrapperFor(comparer);
source0.select(wrapper).into(set0);
Set<Wrapped<TSource>> set1 = new HashSet<>();
try (Enumerator<Wrapped<TSource>> os = source1.select(wrapper).enumerator()) {
while (os.moveNext()) {
Wrapped<TSource> o = os.current();
if (set0.contains(o)) {
set1.add(o);
}
}
}
Function1<Wrapped<TSource>, TSource> unwrapper = unwrapper();
return Linq4j.asEnumerable(set1).select(unwrapper);
}
代码示例来源:origin: org.apache.calcite/calcite-linq4j
/**
* Produces the set difference of two sequences by
* using the specified {@code EqualityComparer<TSource>} to compare
* values.
*/
public static <TSource> Enumerable<TSource> except(
Enumerable<TSource> source0, Enumerable<TSource> source1,
EqualityComparer<TSource> comparer) {
if (comparer == Functions.identityComparer()) {
return except(source0, source1);
}
Set<Wrapped<TSource>> set = new HashSet<>();
Function1<TSource, Wrapped<TSource>> wrapper = wrapperFor(comparer);
source0.select(wrapper).into(set);
try (Enumerator<Wrapped<TSource>> os =
source1.select(wrapper).enumerator()) {
while (os.moveNext()) {
Wrapped<TSource> o = os.current();
set.remove(o);
}
}
Function1<Wrapped<TSource>, TSource> unwrapper = unwrapper();
return Linq4j.asEnumerable(set).select(unwrapper);
}
内容来源于网络,如有侵权,请联系作者删除!