org.apache.calcite.util.Util.intersects()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(2.1k)|赞(0)|评价(0)|浏览(146)

本文整理了Java中org.apache.calcite.util.Util.intersects()方法的一些代码示例,展示了Util.intersects()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.intersects()方法的具体详情如下:
包路径:org.apache.calcite.util.Util
类名称:Util
方法名:intersects

Util.intersects介绍

[英]Returns whether two collections have any elements in common.
[中]返回两个集合是否有任何共同元素。

代码示例

代码示例来源:origin: Qihoo360/Quicksql

/** Unit test for
 * {@link Util#intersects(java.util.Collection, java.util.Collection)}. */
@Test public void testIntersects() {
 final List<String> empty = Collections.emptyList();
 final List<String> listA = Collections.singletonList("a");
 final List<String> listC = Collections.singletonList("c");
 final List<String> listD = Collections.singletonList("d");
 final List<String> listAbc = Arrays.asList("a", "b", "c");
 assertThat(Util.intersects(empty, listA), is(false));
 assertThat(Util.intersects(empty, empty), is(false));
 assertThat(Util.intersects(listA, listAbc), is(true));
 assertThat(Util.intersects(listAbc, listAbc), is(true));
 assertThat(Util.intersects(listAbc, listC), is(true));
 assertThat(Util.intersects(listAbc, listD), is(false));
 assertThat(Util.intersects(listC, listD), is(false));
}

代码示例来源:origin: org.apache.calcite/calcite-core

/** Unit test for
 * {@link Util#intersects(java.util.Collection, java.util.Collection)}. */
@Test public void testIntersects() {
 final List<String> empty = Collections.emptyList();
 final List<String> listA = Collections.singletonList("a");
 final List<String> listC = Collections.singletonList("c");
 final List<String> listD = Collections.singletonList("d");
 final List<String> listAbc = Arrays.asList("a", "b", "c");
 assertThat(Util.intersects(empty, listA), is(false));
 assertThat(Util.intersects(empty, empty), is(false));
 assertThat(Util.intersects(listA, listAbc), is(true));
 assertThat(Util.intersects(listAbc, listAbc), is(true));
 assertThat(Util.intersects(listAbc, listC), is(true));
 assertThat(Util.intersects(listAbc, listD), is(false));
 assertThat(Util.intersects(listC, listD), is(false));
}

相关文章