Package autocomplete.dna
Class SuffixCollection
- java.lang.Object
-
- java.util.AbstractCollection<CharSequence>
-
- autocomplete.dna.SuffixCollection
-
- All Implemented Interfaces:
Iterable<CharSequence>
,Collection<CharSequence>
class SuffixCollection extends AbstractCollection<CharSequence>
Generates all (length - 1) suffixes of the given sequence of characters and presents them in a collection.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
SuffixCollection.SubSequence
A subsequence of the data between the given begin and end indices.private class
SuffixCollection.Suffix
A suffix of the data starting from the given begin index.
-
Field Summary
Fields Modifier and Type Field Description private CharSequence
data
-
Constructor Summary
Constructors Constructor Description SuffixCollection(CharSequence data)
Constructs an unmodifiable collection of (length - 1) suffixes from the data.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Iterator<CharSequence>
iterator()
int
size()
-
Methods inherited from class java.util.AbstractCollection
add, addAll, clear, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
-
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
equals, hashCode, parallelStream, removeIf, spliterator, stream, toArray
-
-
-
-
Field Detail
-
data
private final CharSequence data
-
-
Constructor Detail
-
SuffixCollection
public SuffixCollection(CharSequence data)
Constructs an unmodifiable collection of (length - 1) suffixes from the data.- Parameters:
data
- source for all suffixes.
-
-
Method Detail
-
iterator
public Iterator<CharSequence> iterator()
- Specified by:
iterator
in interfaceCollection<CharSequence>
- Specified by:
iterator
in interfaceIterable<CharSequence>
- Specified by:
iterator
in classAbstractCollection<CharSequence>
-
size
public int size()
- Specified by:
size
in interfaceCollection<CharSequence>
- Specified by:
size
in classAbstractCollection<CharSequence>
-
-