本文整理汇总了Java中com.google.common.base.Predicates.equalTo方法的典型用法代码示例。如果您正苦于以下问题:Java Predicates.equalTo方法的具体用法?Java Predicates.equalTo怎么用?Java Predicates.equalTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.common.base.Predicates
的用法示例。
在下文中一共展示了Predicates.equalTo方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testAny
import com.google.common.base.Predicates; //导入方法依赖的package包/类
public void testAny() {
List<String> list = Lists.newArrayList();
Predicate<String> predicate = Predicates.equalTo("pants");
assertFalse(Iterators.any(list.iterator(), predicate));
list.add("cool");
assertFalse(Iterators.any(list.iterator(), predicate));
list.add("pants");
assertTrue(Iterators.any(list.iterator(), predicate));
}
示例2: testAll
import com.google.common.base.Predicates; //导入方法依赖的package包/类
public void testAll() {
List<String> list = Lists.newArrayList();
Predicate<String> predicate = Predicates.equalTo("cool");
assertTrue(Iterators.all(list.iterator(), predicate));
list.add("cool");
assertTrue(Iterators.all(list.iterator(), predicate));
list.add("pants");
assertFalse(Iterators.all(list.iterator(), predicate));
}
示例3: testAny
import com.google.common.base.Predicates; //导入方法依赖的package包/类
public void testAny() {
List<String> list = newArrayList();
Predicate<String> predicate = Predicates.equalTo("pants");
assertFalse(Iterables.any(list, predicate));
list.add("cool");
assertFalse(Iterables.any(list, predicate));
list.add("pants");
assertTrue(Iterables.any(list, predicate));
}
示例4: testAll
import com.google.common.base.Predicates; //导入方法依赖的package包/类
public void testAll() {
List<String> list = newArrayList();
Predicate<String> predicate = Predicates.equalTo("cool");
assertTrue(Iterables.all(list, predicate));
list.add("cool");
assertTrue(Iterables.all(list, predicate));
list.add("pants");
assertFalse(Iterables.all(list, predicate));
}
示例5: testAnyMatch
import com.google.common.base.Predicates; //导入方法依赖的package包/类
public void testAnyMatch() {
ArrayList<String> list = Lists.newArrayList();
FluentIterable<String> iterable = FluentIterable.<String>from(list);
Predicate<String> predicate = Predicates.equalTo("pants");
assertFalse(iterable.anyMatch(predicate));
list.add("cool");
assertFalse(iterable.anyMatch(predicate));
list.add("pants");
assertTrue(iterable.anyMatch(predicate));
}
示例6: testAllMatch
import com.google.common.base.Predicates; //导入方法依赖的package包/类
public void testAllMatch() {
List<String> list = Lists.newArrayList();
FluentIterable<String> iterable = FluentIterable.<String>from(list);
Predicate<String> predicate = Predicates.equalTo("cool");
assertTrue(iterable.allMatch(predicate));
list.add("cool");
assertTrue(iterable.allMatch(predicate));
list.add("pants");
assertFalse(iterable.allMatch(predicate));
}