mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
Merge pull request #4963 from joefarebrother/guava-collections
Java: Add flow steps for Guava collection utilities
This commit is contained in:
360
java/ql/src/semmle/code/java/frameworks/guava/Collections.qll
Normal file
360
java/ql/src/semmle/code/java/frameworks/guava/Collections.qll
Normal file
@@ -0,0 +1,360 @@
|
||||
/** Definitions of flow steps through the collection types in the Guava framework */
|
||||
|
||||
import java
|
||||
private import semmle.code.java.dataflow.DataFlow
|
||||
private import semmle.code.java.dataflow.FlowSteps
|
||||
private import semmle.code.java.Collections
|
||||
|
||||
private string guavaCollectPackage() { result = "com.google.common.collect" }
|
||||
|
||||
/** A reference type that extends a parameterization of one of the various immutable container types. */
|
||||
private class ImmutableContainerType extends RefType {
|
||||
string kind;
|
||||
|
||||
ImmutableContainerType() {
|
||||
this.getSourceDeclaration().getASourceSupertype*().hasQualifiedName(guavaCollectPackage(), kind) and
|
||||
kind = ["ImmutableCollection", "ImmutableMap", "ImmutableMultimap", "ImmutableTable"]
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name of the most general superclass of this type
|
||||
* from among `ImmutableCollection`, `ImmutableMap`, `ImmutableMultimap`, and `ImmutableTable`.
|
||||
*/
|
||||
string getKind() { result = kind }
|
||||
}
|
||||
|
||||
/** A nested `Builder` class of one of the various immutable container classes */
|
||||
private class ContainerBuilder extends NestedType {
|
||||
ContainerBuilder() {
|
||||
this.hasName("Builder") and
|
||||
this.getEnclosingType() instanceof ImmutableContainerType
|
||||
}
|
||||
}
|
||||
|
||||
private class BuilderBuildMethod extends TaintPreservingCallable {
|
||||
BuilderBuildMethod() {
|
||||
this.getDeclaringType().getASourceSupertype*() instanceof ContainerBuilder and
|
||||
// abstract ImmutableCollection<E> build()
|
||||
// similar for other builder types
|
||||
this.hasName("build")
|
||||
}
|
||||
|
||||
override predicate returnsTaintFrom(int arg) { arg = -1 }
|
||||
}
|
||||
|
||||
/** A method on a `Builder` class that adds elements to the container being built */
|
||||
private class BuilderAddMethod extends TaintPreservingCallable {
|
||||
int argument;
|
||||
|
||||
BuilderAddMethod() {
|
||||
this.getDeclaringType().getASourceSupertype*() instanceof ContainerBuilder and
|
||||
(
|
||||
// abstract ImmutableCollection.Builder<E> add(E element)
|
||||
// ImmutableCollection.Builder<E> add(E... elements)
|
||||
// ImmutableCollection.Builder<E> addAll(Iterable<? extends E> elements)
|
||||
// ImmutableCollection.Builder<E> addAll(Iterator<? extends E> elements)
|
||||
// ImmutableMultiset.Builder<E> addCopies(E element, int occurrences)
|
||||
// ImmutableMultiset.Builder<E> setCount(E element, int count)
|
||||
this.hasName(["add", "addAll", "addCopies", "setCount"]) and
|
||||
argument = 0
|
||||
or
|
||||
// ImmutableMap.Builder<K,V> put(K key, V value)
|
||||
// ImmutableMap.Builder<K,V> put(Map.Entry<? extends K,? extends V> entry)
|
||||
// ImmutableMap.Builder<K,V> putAll(Map<? extends K,? extends V> map)
|
||||
// ImmutableMap.Builder<K,V> putAll(Iterable<? extends Map.Entry<? extends K,? extends V>> entries)
|
||||
// ImmutableMultimap.Builder<K,V> put(K key, V value)
|
||||
// ImmutableMultimap.Builder<K,V> put(Map.Entry<? extends K,? extends V> entry)
|
||||
// ImmutableMultimap.Builder<K,V> putAll(Iterable<? extends Map.Entry<? extends K,? extends V>> entries)
|
||||
// ImmutableMultimap.Builder<K,V> putAll(K key, Iterable<? extends V> values)
|
||||
// ImmutableMultimap.Builder<K,V> putAll(K key, V... values)
|
||||
// ImmutableMultimap.Builder<K,V> putAll(Multimap<? extends K,? extends V> multimap)
|
||||
// ImmutableTable.Builder<R,C,V> put(R rowKey, C columnKey, V value)
|
||||
// ImmutableTable.Builder<R,C,V> put(Table.Cell<? extends R,? extends C,? extends V> cell)
|
||||
// ImmutableTable.Builder<R,C,V> putAll(Table<? extends R,? extends C,? extends V> table)
|
||||
this.hasName(["put", "putAll"]) and
|
||||
argument = getNumberOfParameters() - 1
|
||||
)
|
||||
}
|
||||
|
||||
override predicate returnsTaintFrom(int arg) { arg = [-1, argument] }
|
||||
|
||||
override predicate transfersTaint(int src, int sink) { src = argument and sink = -1 }
|
||||
}
|
||||
|
||||
/**
|
||||
* In a chained call `b.add(x).add(y).add(z)`, represents a flow step from the return value of
|
||||
* this expression to the post update node of `b` (valid because the builder add methods return their qualifier).
|
||||
* This is sufficient to express flow from `y` and `z` to `b`.
|
||||
*/
|
||||
private class ChainedBuilderAddStep extends AdditionalTaintStep {
|
||||
override predicate step(DataFlow::Node src, DataFlow::Node sink) {
|
||||
exists(MethodAccess ma |
|
||||
ma.getMethod() instanceof BuilderAddMethod and
|
||||
src.asExpr() = ma and
|
||||
chainedBuilderMethod+(sink.(DataFlow::PostUpdateNode).getPreUpdateNode().asExpr()) = ma
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private MethodAccess chainedBuilderMethod(Expr e) {
|
||||
result.getQualifier() = e and
|
||||
result.getMethod() instanceof BuilderAddMethod
|
||||
}
|
||||
|
||||
/**
|
||||
* A reference type that extends a parameterization of `com.google.common.collect.Multimap`.
|
||||
*/
|
||||
class MultimapType extends RefType {
|
||||
MultimapType() {
|
||||
this.getSourceDeclaration()
|
||||
.getASourceSupertype*()
|
||||
.hasQualifiedName(guavaCollectPackage(), "Multimap")
|
||||
}
|
||||
|
||||
/** Gets the type of keys stored in this map. */
|
||||
RefType getKeyType() {
|
||||
exists(GenericInterface map | map.hasQualifiedName(guavaCollectPackage(), "Multimap") |
|
||||
indirectlyInstantiates(this, map, 0, result)
|
||||
)
|
||||
}
|
||||
|
||||
/** Gets the type of values stored in this map. */
|
||||
RefType getValueType() {
|
||||
exists(GenericInterface map | map.hasQualifiedName(guavaCollectPackage(), "Multimap") |
|
||||
indirectlyInstantiates(this, map, 1, result)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private class MultimapWriteMethod extends TaintPreservingCallable {
|
||||
MultimapWriteMethod() {
|
||||
this.getDeclaringType() instanceof MultimapType and
|
||||
// boolean put(K key, V value)
|
||||
// boolean putAll(K key, Iterable<? extends V> values)
|
||||
// boolean putAll(Multimap<? extends K,? extends V> multimap)
|
||||
// Collection<V> replaceValues(K key, Iterable<? extends V> values)
|
||||
this.hasName(["put", "putAll", "replaceValues"])
|
||||
}
|
||||
|
||||
override predicate transfersTaint(int src, int sink) {
|
||||
src = getNumberOfParameters() - 1 and
|
||||
sink = -1
|
||||
}
|
||||
}
|
||||
|
||||
private class MultimapReadMethod extends TaintPreservingCallable {
|
||||
MultimapReadMethod() {
|
||||
this.getDeclaringType() instanceof MultimapType and
|
||||
// Collection<V> replaceValues(K key, Iterable<? extends V> values)
|
||||
// Collection<V> removeAll(@CompatibleWith("K") Object key)
|
||||
// Collection<V> get(K key)
|
||||
// Collection<V> values()
|
||||
// Collection<Map.Entry<K,V>> entries()
|
||||
// Map<K,Collection<V>> asMap()
|
||||
this.hasName(["replaceValues", "removeAll", "get", "values", "entries", "asMap"])
|
||||
}
|
||||
|
||||
override predicate returnsTaintFrom(int arg) { arg = -1 }
|
||||
// Not implemented: Some of these methods return "views", which when modified will modify the map itself.
|
||||
// However, taint flow from these views to the map is not implemented.
|
||||
}
|
||||
|
||||
/**
|
||||
* A reference type that extends a parameterization of `com.google.common.collect.Table`.
|
||||
*/
|
||||
class TableType extends RefType {
|
||||
TableType() {
|
||||
this.getSourceDeclaration()
|
||||
.getASourceSupertype*()
|
||||
.hasQualifiedName(guavaCollectPackage(), "Table")
|
||||
}
|
||||
|
||||
/** Gets the type of row keys stored in this table. */
|
||||
RefType getRowType() {
|
||||
exists(GenericInterface table | table.hasQualifiedName(guavaCollectPackage(), "Table") |
|
||||
indirectlyInstantiates(this, table, 0, result)
|
||||
)
|
||||
}
|
||||
|
||||
/** Gets the type of column keys stored in this table. */
|
||||
RefType getColumnType() {
|
||||
exists(GenericInterface table | table.hasQualifiedName(guavaCollectPackage(), "Table") |
|
||||
indirectlyInstantiates(this, table, 1, result)
|
||||
)
|
||||
}
|
||||
|
||||
/** Gets the type of values stored in this table. */
|
||||
RefType getValueType() {
|
||||
exists(GenericInterface table | table.hasQualifiedName(guavaCollectPackage(), "Table") |
|
||||
indirectlyInstantiates(this, table, 2, result)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private class TableWriteMethod extends TaintPreservingCallable {
|
||||
TableWriteMethod() {
|
||||
this.getDeclaringType() instanceof TableType and
|
||||
// V put(R rowKey, C columnKey, V value)
|
||||
// void putAll(Table<? extends R,? extends C,? extends V> table)
|
||||
this.hasName(["put", "putAll"])
|
||||
}
|
||||
|
||||
override predicate transfersTaint(int src, int sink) {
|
||||
src = getNumberOfParameters() - 1 and
|
||||
sink = -1
|
||||
}
|
||||
}
|
||||
|
||||
private class TableReadMethod extends TaintPreservingCallable {
|
||||
TableReadMethod() {
|
||||
this.getDeclaringType() instanceof TableType and
|
||||
// V put(R rowKey, C columnKey, V value)
|
||||
// V remove(@CompatibleWith("R") Object rowKey, @CompatibleWith("C") Object columnKey)
|
||||
// V get(@CompatibleWith("R") Object rowKey, @CompatibleWith("C") Object columnKey)
|
||||
// Map<C,V> row(R rowKey)
|
||||
// Map<R,V> column(C columnKey)
|
||||
// Set<Table.Cell<R,C,V>> cellSet()
|
||||
// Collection<V> values()
|
||||
// Map<R,Map<C,V>> rowMap()
|
||||
// Map<C,Map<R,V>> columnMap()
|
||||
this.hasName([
|
||||
"put", "remove", "get", "row", "column", "cellSet", "values", "rowMap", "columnMap"
|
||||
])
|
||||
}
|
||||
|
||||
override predicate returnsTaintFrom(int arg) { arg = -1 }
|
||||
// Not implemented: Some of these methods return "views", which when modified will modify the table itself.
|
||||
// However, taint flow from these views to the table is not implemented.
|
||||
}
|
||||
|
||||
private class TableCellReadMethod extends TaintPreservingCallable {
|
||||
TableCellReadMethod() {
|
||||
exists(NestedType cell |
|
||||
cell.getEnclosingType() instanceof TableType and
|
||||
cell.hasName("Cell") and
|
||||
this.getDeclaringType().getSourceDeclaration().getASourceSupertype*() = cell and
|
||||
// V getValue()
|
||||
this.hasName("getValue")
|
||||
)
|
||||
}
|
||||
|
||||
override predicate returnsTaintFrom(int arg) { arg = -1 }
|
||||
}
|
||||
|
||||
/**
|
||||
* An `of` static method on the various immutable container types.
|
||||
*/
|
||||
private class OfMethod extends TaintPreservingCallable {
|
||||
string kind;
|
||||
|
||||
OfMethod() {
|
||||
this.getDeclaringType().(ImmutableContainerType).getKind() = kind and
|
||||
// static <E> ImmutableList<E> of(E e1, E e2, E e3, E e4, E e5, E e6)
|
||||
// static <K,V> ImmutableMap<K,V> of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4)
|
||||
// static <K,V> ImmutableMultimap<K,V> of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4)
|
||||
// static <R,C,V> ImmutableTable<R,C,V> of(R rowKey, C columnKey, V value)
|
||||
// etc for other types and numbers of parameters
|
||||
this.hasName("of") and
|
||||
this.isStatic()
|
||||
}
|
||||
|
||||
override predicate returnsTaintFrom(int arg) {
|
||||
arg = [0 .. getNumberOfParameters()] and
|
||||
(kind.regexpMatch(".*[Mm]ap") implies arg % 2 = 1) and
|
||||
(kind = "ImmutableTable" implies arg % 3 = 2)
|
||||
}
|
||||
}
|
||||
|
||||
private class ComparatorType extends RefType {
|
||||
ComparatorType() { this.getASourceSupertype*().hasQualifiedName("java.util", "Comparator") }
|
||||
}
|
||||
|
||||
/**
|
||||
* A `copyOf`, `sortedCopyOf`, or `copyOfSorted` static method on the various immutable container types.
|
||||
*/
|
||||
private class CopyOfMethod extends TaintPreservingCallable {
|
||||
CopyOfMethod() {
|
||||
this.getDeclaringType() instanceof ImmutableContainerType and
|
||||
// static <E> ImmutableList<E> copyOf(E[] elements)
|
||||
// static <E> ImmutableList<E> copyOf(Iterable<? extends E> elements)
|
||||
// static <E> ImmutableList<E> copyOf(Collection<? extends E> elements)
|
||||
// static <E> ImmutableList<E> copyOf(Iterator<? extends E> elements)
|
||||
// static <E extends Comparable<? super E>> ImmutableList<E> sortedCopyOf(Iterable<? extends E> elements)
|
||||
// static <E> ImmutableList<E> sortedCopyOf(Comparator<? super E> comparator, Iterable<? extends E> elements)
|
||||
// static <K,V> ImmutableMap<K,V> copyOf(Map<? extends K,? extends V> map)
|
||||
// static <K,V> ImmutableMap<K,V> copyOf(Iterable<? extends Map.Entry<? extends K,? extends V>> entries)
|
||||
// static <K,V> ImmutableMultimap<K,V> copyOf(Multimap<? extends K,? extends V> multimap)
|
||||
// static <K,V> ImmutableMultimap<K,V> copyOf(Iterable<? extends Map.Entry<? extends K,? extends V>> entries)
|
||||
// static <R,C,V> ImmutableTable<R,C,V> copyOf(Table<? extends R,? extends C,? extends V> table)
|
||||
// static <K, V> ImmutableSortedMap<K, V> copyOf(Map<? extends K, ? extends V> map)
|
||||
// static <K, V> ImmutableSortedMap<K, V> copyOf(Map<? extends K, ? extends V> map, Comparator<? super K> comparator)
|
||||
// static <K, V> ImmutableSortedMap<K, V> copyOfSorted(SortedMap<K, ? extends V> map)
|
||||
// static <E> ImmutableSortedSet<E> copyOf(Iterator<? extends E> elements)
|
||||
// static <E> ImmutableSortedSet<E> copyOf(Comparator<? super E> comparator, Iterator<? extends E> elements)
|
||||
// static <E> ImmutableSortedSet<E> copyOfSorted(SortedSet<E> sortedSet)
|
||||
// etc
|
||||
this.hasName(["copyOf", "sortedCopyOf", "copyOfSorted"]) and
|
||||
this.isStatic()
|
||||
}
|
||||
|
||||
override predicate returnsTaintFrom(int arg) {
|
||||
arg = [0 .. getNumberOfParameters()] and
|
||||
not getParameterType(arg) instanceof ComparatorType
|
||||
}
|
||||
}
|
||||
|
||||
private class CollectionAsListMethod extends TaintPreservingCallable {
|
||||
CollectionAsListMethod() {
|
||||
this.getDeclaringType()
|
||||
.getASourceSupertype*()
|
||||
.hasQualifiedName(guavaCollectPackage(), "ImmutableCollection") and
|
||||
// public ImmutableList<E> asList()
|
||||
this.hasName("asList")
|
||||
}
|
||||
|
||||
override predicate returnsTaintFrom(int arg) { arg = -1 }
|
||||
}
|
||||
|
||||
/**
|
||||
* A taint-preserving static method of `com.google.common.collect.Sets`.
|
||||
*/
|
||||
private class SetsMethod extends TaintPreservingCallable {
|
||||
int arg;
|
||||
|
||||
SetsMethod() {
|
||||
this.getDeclaringType().hasQualifiedName(guavaCollectPackage(), "Sets") and
|
||||
this.isStatic() and
|
||||
(
|
||||
// static <E> HashSet<E> newHashSet(E... elements)
|
||||
// static <E> Set<E> newConcurrentHashSet(Iterable<? extends E> elements)
|
||||
// static <E> CopyOnWriteArraySet<E> newCopyOnWriteArraySet(Iterable<? extends E> elements)
|
||||
// etc
|
||||
this.getName().matches("new%Set") and
|
||||
arg = 0
|
||||
or
|
||||
// static <B> Set<List<B>> cartesianProduct(List<? extends Set<? extends B>> sets)
|
||||
// static <B> Set<List<B>> cartesianProduct(Set<? extends B>... sets)
|
||||
// static <E> Set<Set<E>> combinations(Set<E> set, int size)
|
||||
// static <E> Sets.SetView<E> difference(Set<E> set1, Set<?> set2)
|
||||
// static <E> NavigableSet<E> filter(NavigableSet<E> unfiltered, Predicate<? super E> predicate)
|
||||
// static <E> Set<E> filter(Set<E> unfiltered, Predicate<? super E> predicate)
|
||||
// static <E> SortedSet<E> filter(SortedSet<E> unfiltered, Predicate<? super E> predicate)
|
||||
// static <E> Set<Set<E>> powerSet(Set<E> set)
|
||||
// static <K extends Comparable<? super K>> NavigableSet<K> subSet(NavigableSet<K> set, Range<K> range)
|
||||
// static <E> NavigableSet<E> synchronizedNavigableSet(NavigableSet<E> navigableSet)
|
||||
// static <E> NavigableSet<E> unmodifiableNavigableSet(NavigableSet<E> set)
|
||||
this.hasName([
|
||||
"cartesianProduct", "combinations", "difference", "filter", "powerSet", "subSet",
|
||||
"synchronizedNavigableSet", "unmodifyableNavigableSet"
|
||||
]) and
|
||||
arg = 0
|
||||
or
|
||||
// static <E> Sets.SetView<E> symmetricDifference(Set<? extends E> set1, Set<? extends E> set2)
|
||||
// static <E> Sets.SetView<E> union(Set<? extends E> set1, Set<? extends E> set2)
|
||||
this.hasName(["symmetricDifference", "union"]) and
|
||||
arg = [0, 1]
|
||||
)
|
||||
}
|
||||
|
||||
override predicate returnsTaintFrom(int arg_) { arg_ = arg }
|
||||
}
|
||||
@@ -4,3 +4,4 @@
|
||||
|
||||
import java
|
||||
import StringUtils
|
||||
import Collections
|
||||
|
||||
122
java/ql/test/library-tests/frameworks/guava/TestCollect.java
Normal file
122
java/ql/test/library-tests/frameworks/guava/TestCollect.java
Normal file
@@ -0,0 +1,122 @@
|
||||
package com.google.common.collect;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.SortedSet;
|
||||
import java.util.SortedMap;
|
||||
import java.util.Comparator;
|
||||
|
||||
class TestCollect {
|
||||
String taint() { return "tainted"; }
|
||||
|
||||
void sink(Object o) {}
|
||||
|
||||
void test1() {
|
||||
String x = taint();
|
||||
|
||||
ImmutableSet<String> xs = ImmutableSet.of(x, "y", "z");
|
||||
sink(xs.asList());
|
||||
|
||||
ImmutableSet<String> ys = ImmutableSet.of("a", "b", "c");
|
||||
|
||||
sink(Sets.filter(Sets.union(xs, ys), y -> true));
|
||||
|
||||
sink(Sets.newHashSet("a", "b", "c", "d", x));
|
||||
}
|
||||
|
||||
void test2() {
|
||||
sink(ImmutableList.of(taint(), taint(), taint(), taint())); // expect 4 alerts
|
||||
sink(ImmutableMap.of(taint(), taint(), taint(), taint())); // expect 2 alerts
|
||||
sink(ImmutableMultimap.of(taint(), taint(), taint(), taint())); // expect 2 alerts
|
||||
sink(ImmutableTable.of(taint(),taint(), taint())); // expect 1 alert
|
||||
}
|
||||
|
||||
void test3() {
|
||||
String x = taint();
|
||||
|
||||
ImmutableList.Builder<String> b = ImmutableList.builder();
|
||||
|
||||
b.add("a");
|
||||
sink(b);
|
||||
b.add(x);
|
||||
sink(b.build());
|
||||
|
||||
b = ImmutableList.builder();
|
||||
|
||||
b.add("a").add(x);
|
||||
sink(b.build());
|
||||
|
||||
sink(ImmutableList.builder().add("a").add(x).build());
|
||||
|
||||
ImmutableMap.Builder<String, String> b2 = ImmutableMap.builder();
|
||||
b2.put(x,"v");
|
||||
sink(b2);
|
||||
b2.put("k",x);
|
||||
sink(b2.build());
|
||||
}
|
||||
|
||||
void test4(Table<String, String, String> t1, Table<String, String, String> t2, Table<String, String, String> t3) {
|
||||
String x = taint();
|
||||
t1.put(x, "c", "v");
|
||||
sink(t1);
|
||||
t1.put("r", x, "v");
|
||||
sink(t1);
|
||||
t1.put("r", "c", x);
|
||||
sink(t1);
|
||||
sink(t1.row("r"));
|
||||
|
||||
t2.putAll(t1);
|
||||
for (Table.Cell<String,String,String> c : t2.cellSet()) {
|
||||
sink(c.getValue());
|
||||
}
|
||||
|
||||
sink(t1.remove("r", "c"));
|
||||
|
||||
t3.row("r").put("c", x);
|
||||
sink(t3); // Not detected
|
||||
}
|
||||
|
||||
void test4(Multimap<String, String> m1, Multimap<String, String> m2, Multimap<String, String> m3,
|
||||
Multimap<String, String> m4, Multimap<String, String> m5){
|
||||
String x = taint();
|
||||
m1.put("k", x);
|
||||
sink(m1);
|
||||
sink(m1.get("k"));
|
||||
|
||||
m2.putAll("k", ImmutableList.of("a", x, "b"));
|
||||
sink(m2);
|
||||
|
||||
m3.putAll(m1);
|
||||
sink(m3);
|
||||
|
||||
m4.replaceValues("k", m1.replaceValues("k", ImmutableList.of("a")));
|
||||
for (Map.Entry<String, String> e : m4.entries()) {
|
||||
sink(e.getValue());
|
||||
}
|
||||
|
||||
m5.asMap().get("k").add(x);
|
||||
sink(m5); // Not detected
|
||||
}
|
||||
|
||||
void test5(Comparator<String> comp, SortedSet<String> sorS, SortedMap<String, String> sorM) {
|
||||
ImmutableSortedSet<String> s = ImmutableSortedSet.of(taint());
|
||||
|
||||
sink(s);
|
||||
sink(ImmutableSortedSet.copyOf(s));
|
||||
sink(ImmutableSortedSet.copyOf(comp, s));
|
||||
|
||||
sorS.add(taint());
|
||||
sink(ImmutableSortedSet.copyOfSorted(sorS));
|
||||
|
||||
sink(ImmutableList.sortedCopyOf(s));
|
||||
sink(ImmutableList.sortedCopyOf(comp, s));
|
||||
|
||||
ImmutableSortedMap<String, String> m = ImmutableSortedMap.of("k", taint());
|
||||
|
||||
sink(m);
|
||||
sink(ImmutableSortedMap.copyOf(m));
|
||||
sink(ImmutableSortedMap.copyOf(m, comp));
|
||||
|
||||
sorM.put("k", taint());
|
||||
sink(ImmutableSortedMap.copyOfSorted(sorM));
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ import com.google.common.base.Joiner;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
|
||||
class Test {
|
||||
class TestStrings {
|
||||
String taint() { return "tainted"; }
|
||||
|
||||
void sink(Object o) {}
|
||||
@@ -1,17 +1,52 @@
|
||||
| Test.java:15:20:15:26 | taint(...) | Test.java:17:14:17:41 | padStart(...) |
|
||||
| Test.java:15:20:15:26 | taint(...) | Test.java:18:14:18:39 | padEnd(...) |
|
||||
| Test.java:15:20:15:26 | taint(...) | Test.java:19:14:19:33 | repeat(...) |
|
||||
| Test.java:15:20:15:26 | taint(...) | Test.java:20:14:20:56 | emptyToNull(...) |
|
||||
| Test.java:15:20:15:26 | taint(...) | Test.java:21:14:21:40 | lenientFormat(...) |
|
||||
| Test.java:15:20:15:26 | taint(...) | Test.java:24:14:24:51 | lenientFormat(...) |
|
||||
| Test.java:28:20:28:26 | taint(...) | Test.java:32:14:32:23 | split(...) |
|
||||
| Test.java:28:20:28:26 | taint(...) | Test.java:33:14:33:29 | splitToList(...) |
|
||||
| Test.java:28:20:28:26 | taint(...) | Test.java:35:14:35:50 | split(...) |
|
||||
| Test.java:39:20:39:26 | taint(...) | Test.java:46:14:46:54 | appendTo(...) |
|
||||
| Test.java:39:20:39:26 | taint(...) | Test.java:47:14:47:26 | toString(...) |
|
||||
| Test.java:39:20:39:26 | taint(...) | Test.java:48:14:48:51 | appendTo(...) |
|
||||
| Test.java:39:20:39:26 | taint(...) | Test.java:49:14:49:26 | toString(...) |
|
||||
| Test.java:39:20:39:26 | taint(...) | Test.java:52:14:52:42 | appendTo(...) |
|
||||
| Test.java:39:20:39:26 | taint(...) | Test.java:57:14:57:56 | join(...) |
|
||||
| Test.java:39:20:39:26 | taint(...) | Test.java:58:14:58:82 | join(...) |
|
||||
| Test.java:39:20:39:26 | taint(...) | Test.java:60:14:60:58 | join(...) |
|
||||
| TestCollect.java:14:20:14:26 | taint(...) | TestCollect.java:17:14:17:24 | asList(...) |
|
||||
| TestCollect.java:14:20:14:26 | taint(...) | TestCollect.java:21:14:21:55 | filter(...) |
|
||||
| TestCollect.java:14:20:14:26 | taint(...) | TestCollect.java:23:14:23:51 | newHashSet(...) |
|
||||
| TestCollect.java:27:31:27:37 | taint(...) | TestCollect.java:27:14:27:65 | of(...) |
|
||||
| TestCollect.java:27:40:27:46 | taint(...) | TestCollect.java:27:14:27:65 | of(...) |
|
||||
| TestCollect.java:27:49:27:55 | taint(...) | TestCollect.java:27:14:27:65 | of(...) |
|
||||
| TestCollect.java:27:58:27:64 | taint(...) | TestCollect.java:27:14:27:65 | of(...) |
|
||||
| TestCollect.java:28:39:28:45 | taint(...) | TestCollect.java:28:14:28:64 | of(...) |
|
||||
| TestCollect.java:28:57:28:63 | taint(...) | TestCollect.java:28:14:28:64 | of(...) |
|
||||
| TestCollect.java:29:44:29:50 | taint(...) | TestCollect.java:29:14:29:69 | of(...) |
|
||||
| TestCollect.java:29:62:29:68 | taint(...) | TestCollect.java:29:14:29:69 | of(...) |
|
||||
| TestCollect.java:30:49:30:55 | taint(...) | TestCollect.java:30:14:30:56 | of(...) |
|
||||
| TestCollect.java:34:20:34:26 | taint(...) | TestCollect.java:41:14:41:22 | build(...) |
|
||||
| TestCollect.java:34:20:34:26 | taint(...) | TestCollect.java:46:14:46:22 | build(...) |
|
||||
| TestCollect.java:34:20:34:26 | taint(...) | TestCollect.java:48:14:48:60 | build(...) |
|
||||
| TestCollect.java:34:20:34:26 | taint(...) | TestCollect.java:54:14:54:23 | build(...) |
|
||||
| TestCollect.java:58:20:58:26 | taint(...) | TestCollect.java:64:14:64:15 | t1 |
|
||||
| TestCollect.java:58:20:58:26 | taint(...) | TestCollect.java:65:14:65:24 | row(...) |
|
||||
| TestCollect.java:58:20:58:26 | taint(...) | TestCollect.java:69:18:69:29 | getValue(...) |
|
||||
| TestCollect.java:58:20:58:26 | taint(...) | TestCollect.java:72:14:72:32 | remove(...) |
|
||||
| TestCollect.java:80:20:80:26 | taint(...) | TestCollect.java:82:14:82:15 | m1 |
|
||||
| TestCollect.java:80:20:80:26 | taint(...) | TestCollect.java:83:14:83:24 | get(...) |
|
||||
| TestCollect.java:80:20:80:26 | taint(...) | TestCollect.java:86:14:86:15 | m2 |
|
||||
| TestCollect.java:80:20:80:26 | taint(...) | TestCollect.java:89:14:89:15 | m3 |
|
||||
| TestCollect.java:80:20:80:26 | taint(...) | TestCollect.java:93:18:93:29 | getValue(...) |
|
||||
| TestCollect.java:101:62:101:68 | taint(...) | TestCollect.java:103:14:103:14 | s |
|
||||
| TestCollect.java:101:62:101:68 | taint(...) | TestCollect.java:104:14:104:41 | copyOf(...) |
|
||||
| TestCollect.java:101:62:101:68 | taint(...) | TestCollect.java:105:14:105:47 | copyOf(...) |
|
||||
| TestCollect.java:101:62:101:68 | taint(...) | TestCollect.java:110:14:110:42 | sortedCopyOf(...) |
|
||||
| TestCollect.java:101:62:101:68 | taint(...) | TestCollect.java:111:14:111:48 | sortedCopyOf(...) |
|
||||
| TestCollect.java:107:18:107:24 | taint(...) | TestCollect.java:108:14:108:50 | copyOfSorted(...) |
|
||||
| TestCollect.java:113:75:113:81 | taint(...) | TestCollect.java:115:14:115:14 | m |
|
||||
| TestCollect.java:113:75:113:81 | taint(...) | TestCollect.java:116:14:116:41 | copyOf(...) |
|
||||
| TestCollect.java:113:75:113:81 | taint(...) | TestCollect.java:117:14:117:47 | copyOf(...) |
|
||||
| TestCollect.java:119:23:119:29 | taint(...) | TestCollect.java:120:14:120:50 | copyOfSorted(...) |
|
||||
| TestStrings.java:15:20:15:26 | taint(...) | TestStrings.java:17:14:17:41 | padStart(...) |
|
||||
| TestStrings.java:15:20:15:26 | taint(...) | TestStrings.java:18:14:18:39 | padEnd(...) |
|
||||
| TestStrings.java:15:20:15:26 | taint(...) | TestStrings.java:19:14:19:33 | repeat(...) |
|
||||
| TestStrings.java:15:20:15:26 | taint(...) | TestStrings.java:20:14:20:56 | emptyToNull(...) |
|
||||
| TestStrings.java:15:20:15:26 | taint(...) | TestStrings.java:21:14:21:40 | lenientFormat(...) |
|
||||
| TestStrings.java:15:20:15:26 | taint(...) | TestStrings.java:24:14:24:51 | lenientFormat(...) |
|
||||
| TestStrings.java:28:20:28:26 | taint(...) | TestStrings.java:32:14:32:23 | split(...) |
|
||||
| TestStrings.java:28:20:28:26 | taint(...) | TestStrings.java:33:14:33:29 | splitToList(...) |
|
||||
| TestStrings.java:28:20:28:26 | taint(...) | TestStrings.java:35:14:35:50 | split(...) |
|
||||
| TestStrings.java:39:20:39:26 | taint(...) | TestStrings.java:46:14:46:54 | appendTo(...) |
|
||||
| TestStrings.java:39:20:39:26 | taint(...) | TestStrings.java:47:14:47:26 | toString(...) |
|
||||
| TestStrings.java:39:20:39:26 | taint(...) | TestStrings.java:48:14:48:51 | appendTo(...) |
|
||||
| TestStrings.java:39:20:39:26 | taint(...) | TestStrings.java:49:14:49:26 | toString(...) |
|
||||
| TestStrings.java:39:20:39:26 | taint(...) | TestStrings.java:52:14:52:42 | appendTo(...) |
|
||||
| TestStrings.java:39:20:39:26 | taint(...) | TestStrings.java:57:14:57:56 | join(...) |
|
||||
| TestStrings.java:39:20:39:26 | taint(...) | TestStrings.java:58:14:58:82 | join(...) |
|
||||
| TestStrings.java:39:20:39:26 | taint(...) | TestStrings.java:60:14:60:58 | join(...) |
|
||||
|
||||
@@ -25,7 +25,7 @@ public final class Splitter {
|
||||
}
|
||||
|
||||
public Splitter omitEmptyStrings() {
|
||||
return null;;
|
||||
return null;
|
||||
}
|
||||
|
||||
public Iterable<String> split(final CharSequence sequence) {
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* Copyright (C) 2012 The Guava Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.google.common.collect;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
|
||||
abstract class AbstractMultimap<K, V> implements Multimap<K, V> {
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsValue(Object value) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsEntry(Object key, Object value) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean remove(Object key, Object value) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean put(K key, V value) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean putAll(K key, Iterable<? extends V> values) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean putAll(Multimap<? extends K, ? extends V> multimap) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<V> replaceValues(K key, Iterable<? extends V> values) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Entry<K, V>> entries() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<K> keySet() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Multiset<K> keys() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<V> values() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<K, Collection<V>> asMap() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* Copyright (C) 2013 The Guava Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License
|
||||
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||
* or implied. See the License for the specific language governing permissions and limitations under
|
||||
* the License.
|
||||
*/
|
||||
|
||||
package com.google.common.collect;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
abstract class AbstractTable<R, C, V> implements Table<R, C, V> {
|
||||
@Override
|
||||
public boolean containsRow(Object rowKey) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsColumn(Object columnKey) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<R> rowKeySet() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<C> columnKeySet() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsValue(Object value) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(Object rowKey, Object columnKey) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public V get(Object rowKey, Object columnKey) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public V remove(Object rowKey, Object columnKey) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public V put(R rowKey, C columnKey, V value) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putAll(Table<? extends R, ? extends C, ? extends V> table) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Cell<R, C, V>> cellSet() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<V> values() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (C) 2008 The Guava Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.google.common.collect;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.AbstractCollection;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
|
||||
public abstract class ImmutableCollection<E> extends AbstractCollection<E> implements Serializable {
|
||||
ImmutableCollection() {}
|
||||
|
||||
public ImmutableList<E> asList() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public abstract static class Builder<E> {
|
||||
Builder() {}
|
||||
|
||||
public abstract Builder<E> add(E element);
|
||||
|
||||
public Builder<E> add(E... elements) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Builder<E> addAll(Iterable<? extends E> elements) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Builder<E> addAll(Iterator<? extends E> elements) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public abstract ImmutableCollection<E> build();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
* Copyright (C) 2007 The Guava Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.google.common.collect;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public abstract class ImmutableList<E> extends ImmutableCollection<E>
|
||||
implements List<E>{
|
||||
|
||||
public static <E> ImmutableList<E> of() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E> ImmutableList<E> of(E element) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E> ImmutableList<E> of(E e1, E e2) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E> ImmutableList<E> of(E e1, E e2, E e3) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E> ImmutableList<E> of(E e1, E e2, E e3, E e4) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E> ImmutableList<E> of(
|
||||
E e1, E e2, E e3, E e4, E e5, E e6, E e7, E e8, E e9, E e10, E e11, E e12, E... others) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E> ImmutableList<E> copyOf(Iterable<? extends E> elements) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E> ImmutableList<E> copyOf(Collection<? extends E> elements) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E> ImmutableList<E> copyOf(Iterator<? extends E> elements) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E> ImmutableList<E> copyOf(E[] elements) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E extends Comparable<? super E>> ImmutableList<E> sortedCopyOf(
|
||||
Iterable<? extends E> elements) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E> ImmutableList<E> sortedCopyOf(
|
||||
Comparator<? super E> comparator, Iterable<? extends E> elements) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ImmutableList() {}
|
||||
|
||||
public ImmutableList<E> reverse() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E> Builder<E> builder() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static final class Builder<E> extends ImmutableCollection.Builder<E> {
|
||||
@Override
|
||||
public Builder<E> add(E element) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImmutableList<E> build() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
/*
|
||||
* Copyright (C) 2008 The Guava Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.google.common.collect;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
import java.util.Map;
|
||||
|
||||
public abstract class ImmutableMap<K, V> implements Map<K, V> {
|
||||
public static <K, V> ImmutableMap<K, V> of() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <K, V> ImmutableMap<K, V> of(K k1, V v1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <K, V> ImmutableMap<K, V> of(K k1, V v1, K k2, V v2) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <K, V> ImmutableMap<K, V> of(K k1, V v1, K k2, V v2, K k3, V v3) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <K, V> ImmutableMap<K, V> of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <K, V> ImmutableMap<K, V> of(
|
||||
K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <K, V> Builder<K, V> builder() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <K, V> Builder<K, V> builderWithExpectedSize(int expectedSize) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class Builder<K, V> {
|
||||
public Builder() {
|
||||
}
|
||||
|
||||
public Builder<K, V> put(K key, V value) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Builder<K, V> put(Entry<? extends K, ? extends V> entry) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Builder<K, V> putAll(Map<? extends K, ? extends V> map) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Builder<K, V> putAll(Iterable<? extends Entry<? extends K, ? extends V>> entries) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Builder<K, V> orderEntriesByValue(Comparator<? super V> valueComparator) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public ImmutableMap<K, V> build() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
public static <K, V> ImmutableMap<K, V> copyOf(Map<? extends K, ? extends V> map) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <K, V> ImmutableMap<K, V> copyOf(
|
||||
Iterable<? extends Entry<? extends K, ? extends V>> entries) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final V put(K k, V v) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void putAll(Map<? extends K, ? extends V> map) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public final V remove(Object o) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void clear() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsKey(Object key) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsValue(Object value) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public abstract V get(Object key);
|
||||
|
||||
@Override
|
||||
public ImmutableSet<Entry<K, V>> entrySet() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImmutableSet<K> keySet() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImmutableCollection<V> values() {
|
||||
return null;
|
||||
}
|
||||
|
||||
// public ImmutableSetMultimap<K, V> asMultimap() {
|
||||
// return null;
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
/*
|
||||
* Copyright (C) 2008 The Guava Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.google.common.collect;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public abstract class ImmutableMultimap<K, V> extends AbstractMultimap<K, V> {
|
||||
public static <K, V> ImmutableMultimap<K, V> of() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <K, V> ImmutableMultimap<K, V> of(K k1, V v1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <K, V> ImmutableMultimap<K, V> of(K k1, V v1, K k2, V v2) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <K, V> ImmutableMultimap<K, V> of(K k1, V v1, K k2, V v2, K k3, V v3) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <K, V> ImmutableMultimap<K, V> of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <K, V> ImmutableMultimap<K, V> of(
|
||||
K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <K, V> Builder<K, V> builder() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class Builder<K, V> {
|
||||
public Builder() {
|
||||
}
|
||||
|
||||
public Builder<K, V> put(K key, V value) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Builder<K, V> put(Entry<? extends K, ? extends V> entry) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Builder<K, V> putAll(Iterable<? extends Entry<? extends K, ? extends V>> entries) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Builder<K, V> putAll(K key, Iterable<? extends V> values) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Builder<K, V> putAll(K key, V... values) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Builder<K, V> putAll(Multimap<? extends K, ? extends V> multimap) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Builder<K, V> orderKeysBy(Comparator<? super K> keyComparator) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Builder<K, V> orderValuesBy(Comparator<? super V> valueComparator) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public ImmutableMultimap<K, V> build() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
public static <K, V> ImmutableMultimap<K, V> copyOf(Multimap<? extends K, ? extends V> multimap) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <K, V> ImmutableMultimap<K, V> copyOf(
|
||||
Iterable<? extends Entry<? extends K, ? extends V>> entries) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImmutableCollection<V> removeAll(Object key) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public abstract ImmutableCollection<V> get(K key);
|
||||
|
||||
public abstract ImmutableMultimap<V, K> inverse();
|
||||
|
||||
@Override
|
||||
public boolean containsKey(Object key) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
/*
|
||||
* Copyright (C) 2008 The Guava Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.google.common.collect;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
|
||||
public abstract class ImmutableMultiset<E> extends ImmutableCollection<E>
|
||||
implements Multiset<E> {
|
||||
|
||||
public static <E> ImmutableMultiset<E> of() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E> ImmutableMultiset<E> of(E element) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E> ImmutableMultiset<E> of(E e1, E e2) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E> ImmutableMultiset<E> of(E e1, E e2, E e3) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E> ImmutableMultiset<E> of(E e1, E e2, E e3, E e4) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E> ImmutableMultiset<E> of(E e1, E e2, E e3, E e4, E e5) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E> ImmutableMultiset<E> of(E e1, E e2, E e3, E e4, E e5, E e6, E... others) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E> ImmutableMultiset<E> copyOf(E[] elements) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E> ImmutableMultiset<E> copyOf(Iterable<? extends E> elements) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E> ImmutableMultiset<E> copyOf(Iterator<? extends E> elements) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(Object object) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int add(E element, int occurrences) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int remove(Object element, int occurrences) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final int setCount(E element, int count) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final boolean setCount(E element, int oldCount, int newCount) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public abstract ImmutableSet<E> elementSet();
|
||||
|
||||
@Override
|
||||
public ImmutableSet<Entry<E>> entrySet() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E> Builder<E> builder() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class Builder<E> extends ImmutableCollection.Builder<E> {
|
||||
public Builder() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder<E> add(E element) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Builder<E> addCopies(E element, int occurrences) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Builder<E> setCount(E element, int count) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImmutableMultiset<E> build() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Copyright (C) 2007 The Guava Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.google.common.collect;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
|
||||
public abstract class ImmutableSet<E> extends ImmutableCollection<E> implements Set<E> {
|
||||
public static <E> ImmutableSet<E> of() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E> ImmutableSet<E> of(E element) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E> ImmutableSet<E> of(E e1, E e2) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E> ImmutableSet<E> of(E e1, E e2, E e3) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E> ImmutableSet<E> of(E e1, E e2, E e3, E e4) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E> ImmutableSet<E> of(E e1, E e2, E e3, E e4, E e5) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E> ImmutableSet<E> of(E e1, E e2, E e3, E e4, E e5, E e6, E... others) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E> ImmutableSet<E> copyOf(Collection<? extends E> elements) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E> ImmutableSet<E> copyOf(Iterable<? extends E> elements) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E> ImmutableSet<E> copyOf(Iterator<? extends E> elements) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E> ImmutableSet<E> copyOf(E[] elements) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ImmutableSet() {}
|
||||
|
||||
public static <E> Builder<E> builder() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class Builder<E> extends ImmutableCollection.Builder<E> {
|
||||
public Builder() {
|
||||
}
|
||||
|
||||
public Builder<E> add(E element) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public ImmutableSet<E> build() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
/*
|
||||
* Copyright (C) 2009 The Guava Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.google.common.collect;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.Map;
|
||||
import java.util.SortedMap;
|
||||
|
||||
public final class ImmutableSortedMap<K, V> extends ImmutableMap<K, V>{
|
||||
|
||||
public static <K, V> ImmutableSortedMap<K, V> of() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <K extends Comparable<? super K>, V> ImmutableSortedMap<K, V> of(K k1, V v1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <K extends Comparable<? super K>, V> ImmutableSortedMap<K, V> of(
|
||||
K k1, V v1, K k2, V v2) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <K extends Comparable<? super K>, V> ImmutableSortedMap<K, V> of(
|
||||
K k1, V v1, K k2, V v2, K k3, V v3) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <K extends Comparable<? super K>, V> ImmutableSortedMap<K, V> of(
|
||||
K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <K extends Comparable<? super K>, V> ImmutableSortedMap<K, V> of(
|
||||
K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <K, V> ImmutableSortedMap<K, V> copyOf(Map<? extends K, ? extends V> map) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <K, V> ImmutableSortedMap<K, V> copyOf(
|
||||
Map<? extends K, ? extends V> map, Comparator<? super K> comparator) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <K, V> ImmutableSortedMap<K, V> copyOf(
|
||||
Iterable<? extends Entry<? extends K, ? extends V>> entries) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <K, V> ImmutableSortedMap<K, V> copyOf(
|
||||
Iterable<? extends Entry<? extends K, ? extends V>> entries,
|
||||
Comparator<? super K> comparator) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <K, V> ImmutableSortedMap<K, V> copyOfSorted(SortedMap<K, ? extends V> map) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public V get(Object key) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static <K extends Comparable<?>, V> Builder<K, V> naturalOrder() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <K, V> Builder<K, V> orderedBy(Comparator<K> comparator) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <K extends Comparable<?>, V> Builder<K, V> reverseOrder() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static class Builder<K, V> extends ImmutableMap.Builder<K, V> {
|
||||
public Builder(Comparator<? super K> comparator) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
* Copyright (C) 2008 The Guava Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.google.common.collect;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
import java.util.Iterator;
|
||||
import java.util.NavigableSet;
|
||||
import java.util.SortedSet;
|
||||
|
||||
public abstract class ImmutableSortedSet<E> extends ImmutableSet<E>
|
||||
implements NavigableSet<E> {
|
||||
|
||||
public static <E> ImmutableSortedSet<E> of() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E extends Comparable<? super E>> ImmutableSortedSet<E> of(E element) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E extends Comparable<? super E>> ImmutableSortedSet<E> of(E e1, E e2) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E extends Comparable<? super E>> ImmutableSortedSet<E> of(E e1, E e2, E e3) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E extends Comparable<? super E>> ImmutableSortedSet<E> of(E e1, E e2, E e3, E e4) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E extends Comparable<? super E>> ImmutableSortedSet<E> of(
|
||||
E e1, E e2, E e3, E e4, E e5) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E extends Comparable<? super E>> ImmutableSortedSet<E> of(
|
||||
E e1, E e2, E e3, E e4, E e5, E e6, E... remaining) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E extends Comparable<? super E>> ImmutableSortedSet<E> copyOf(E[] elements) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E> ImmutableSortedSet<E> copyOf(Iterable<? extends E> elements) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E> ImmutableSortedSet<E> copyOf(Collection<? extends E> elements) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E> ImmutableSortedSet<E> copyOf(Iterator<? extends E> elements) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E> ImmutableSortedSet<E> copyOf(
|
||||
Comparator<? super E> comparator, Iterator<? extends E> elements) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E> ImmutableSortedSet<E> copyOf(
|
||||
Comparator<? super E> comparator, Iterable<? extends E> elements) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E> ImmutableSortedSet<E> copyOf(
|
||||
Comparator<? super E> comparator, Collection<? extends E> elements) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E> ImmutableSortedSet<E> copyOfSorted(SortedSet<E> sortedSet) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E> Builder<E> orderedBy(Comparator<E> comparator) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E extends Comparable<?>> Builder<E> reverseOrder() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E extends Comparable<?>> Builder<E> naturalOrder() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static final class Builder<E> extends ImmutableSet.Builder<E> {
|
||||
public Builder(Comparator<? super E> comparator) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
/*
|
||||
* Copyright (C) 2009 The Guava Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.google.common.collect;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public abstract class ImmutableTable<R, C, V> extends AbstractTable<R, C, V> {
|
||||
|
||||
public static <R, C, V> ImmutableTable<R, C, V> of() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <R, C, V> ImmutableTable<R, C, V> of(R rowKey, C columnKey, V value) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <R, C, V> ImmutableTable<R, C, V> copyOf(
|
||||
Table<? extends R, ? extends C, ? extends V> table) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <R, C, V> Builder<R, C, V> builder() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static final class Builder<R, C, V> {
|
||||
public Builder() {}
|
||||
|
||||
public Builder<R, C, V> put(R rowKey, C columnKey, V value) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Builder<R, C, V> put(Cell<? extends R, ? extends C, ? extends V> cell) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Builder<R, C, V> putAll(Table<? extends R, ? extends C, ? extends V> table) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public ImmutableTable<R, C, V> build() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public ImmutableSet<Cell<R, C, V>> cellSet() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImmutableCollection<V> values() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImmutableMap<R, V> column(C columnKey) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImmutableSet<C> columnKeySet() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public abstract ImmutableMap<C, Map<R, V>> columnMap();
|
||||
|
||||
@Override
|
||||
public ImmutableMap<C, V> row(R rowKey) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImmutableSet<R> rowKeySet() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public abstract ImmutableMap<R, Map<C, V>> rowMap();
|
||||
|
||||
@Override
|
||||
public boolean contains(Object rowKey, Object columnKey) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean containsValue(Object value) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void clear() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public final V put(R rowKey, C columnKey, V value) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void putAll(Table<? extends R, ? extends C, ? extends V> table) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public final V remove(Object rowKey, Object columnKey) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright (C) 2007 The Guava Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.google.common.collect;
|
||||
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
public interface Multimap<K, V> {
|
||||
int size();
|
||||
|
||||
boolean isEmpty();
|
||||
|
||||
boolean containsKey(Object key);
|
||||
|
||||
boolean containsValue(Object value);
|
||||
|
||||
boolean containsEntry(Object key, Object value);
|
||||
|
||||
boolean put(K key, V value);
|
||||
|
||||
boolean remove(Object key, Object value);
|
||||
|
||||
boolean putAll(K key, Iterable<? extends V> values);
|
||||
|
||||
boolean putAll(Multimap<? extends K, ? extends V> multimap);
|
||||
|
||||
Collection<V> replaceValues(K key, Iterable<? extends V> values);
|
||||
|
||||
Collection<V> removeAll(Object key);
|
||||
|
||||
void clear();
|
||||
|
||||
Collection<V> get(K key);
|
||||
|
||||
Set<K> keySet();
|
||||
|
||||
Multiset<K> keys();
|
||||
|
||||
Collection<V> values();
|
||||
|
||||
Collection<Entry<K, V>> entries();
|
||||
|
||||
default void forEach(BiConsumer<? super K, ? super V> action) {
|
||||
}
|
||||
|
||||
Map<K, Collection<V>> asMap();
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (C) 2007 The Guava Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.google.common.collect;
|
||||
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
import java.util.function.ObjIntConsumer;
|
||||
|
||||
public interface Multiset<E> extends Collection<E> {
|
||||
int count(Object element);
|
||||
|
||||
int add(E element, int occurrences);
|
||||
|
||||
int remove(Object element, int occurrences);
|
||||
|
||||
int setCount(E element, int count);
|
||||
|
||||
boolean setCount(E element, int oldCount, int newCount);
|
||||
|
||||
Set<E> elementSet();
|
||||
|
||||
Set<Entry<E>> entrySet();
|
||||
|
||||
default void forEachEntry(ObjIntConsumer<? super E> action) {
|
||||
}
|
||||
|
||||
boolean equals(Object object);
|
||||
|
||||
interface Entry<E> {
|
||||
E getElement();
|
||||
|
||||
int getCount();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* Copyright (C) 2007 The Guava Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.google.common.collect;
|
||||
|
||||
import java.util.AbstractSet;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.NavigableSet;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.Set;
|
||||
import java.util.function.Predicate;
|
||||
|
||||
public final class Sets {
|
||||
private Sets() {}
|
||||
|
||||
public static <E> HashSet<E> newHashSet() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E> HashSet<E> newHashSet(E... elements) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E> HashSet<E> newHashSet(Iterable<? extends E> elements) {
|
||||
return null;
|
||||
}
|
||||
public abstract static class SetView<E> extends AbstractSet<E> {
|
||||
private SetView() {}
|
||||
}
|
||||
|
||||
public static <E> SetView<E> union(final Set<? extends E> set1, final Set<? extends E> set2) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E> SetView<E> intersection(final Set<E> set1, final Set<?> set2) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E> SetView<E> difference(final Set<E> set1, final Set<?> set2) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E> SetView<E> symmetricDifference(
|
||||
final Set<? extends E> set1, final Set<? extends E> set2) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E> Set<E> filter(Set<E> unfiltered, Predicate<? super E> predicate) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public static <B> Set<List<B>> cartesianProduct(List<? extends Set<? extends B>> sets) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <B> Set<List<B>> cartesianProduct(Set<? extends B>... sets) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E> Set<Set<E>> powerSet(Set<E> set) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E> Set<Set<E>> combinations(Set<E> set, final int size) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <E> NavigableSet<E> synchronizedNavigableSet(NavigableSet<E> navigableSet) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <K extends Comparable<? super K>> NavigableSet<K> subSet(
|
||||
NavigableSet<K> set, Object range) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright (C) 2008 The Guava Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.google.common.collect;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public interface Table<R, C, V> {
|
||||
boolean contains(Object rowKey, Object columnKey);
|
||||
|
||||
boolean containsRow(Object rowKey);
|
||||
|
||||
boolean containsColumn(Object columnKey);
|
||||
|
||||
boolean containsValue(Object value);
|
||||
|
||||
V get(Object rowKey, Object columnKey);
|
||||
|
||||
boolean isEmpty();
|
||||
|
||||
int size();
|
||||
|
||||
void clear();
|
||||
|
||||
V put(R rowKey, C columnKey, V value);
|
||||
|
||||
void putAll(Table<? extends R, ? extends C, ? extends V> table);
|
||||
|
||||
V remove(Object rowKey, Object columnKey);
|
||||
|
||||
Map<C, V> row(R rowKey);
|
||||
|
||||
Map<R, V> column(C columnKey);
|
||||
|
||||
Set<Cell<R, C, V>> cellSet();
|
||||
|
||||
Set<R> rowKeySet();
|
||||
|
||||
Set<C> columnKeySet();
|
||||
|
||||
Collection<V> values();
|
||||
|
||||
Map<R, Map<C, V>> rowMap();
|
||||
|
||||
Map<C, Map<R, V>> columnMap();
|
||||
|
||||
interface Cell<R, C, V> {
|
||||
R getRowKey();
|
||||
|
||||
C getColumnKey();
|
||||
|
||||
V getValue();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user