@Immutable public final class SearchPath extends Object implements List<String>
SearchPath
objects, via the valueOf(String)
constructor. Once
constructed, you can traverse the nodes by invoking advanceToNextNode()
. If already at last node
and you invoke advanceToNextNode()
again, then it will circle back to the first node. In other words
this class is modular in that way, so be mindful of this when you write code that invokes it.
Methods such as currentNode()
and isAtEndOfSearchPath()
, allow you to query
the current state of the SearchPath
object. Also because this class implements List
, all the read-only
methods are available for you to invoke. However invoking methods that modify state will throw
UnsupportedOperationException
.
Last but not least, for space efficiency, instances of this class are internally cached.
Created by QuijadaJ on 5/3/2017.Modifier and Type | Method and Description |
---|---|
void |
add(int index,
String element) |
boolean |
add(String s) |
boolean |
addAll(Collection<? extends String> c) |
boolean |
addAll(int index,
Collection<? extends String> c) |
void |
clear() |
boolean |
contains(Object o) |
boolean |
containsAll(Collection<?> c) |
boolean |
equals(Object o) |
String |
get(int index) |
int |
hashCode() |
int |
indexOf(Object o) |
boolean |
isEmpty() |
Iterator<String> |
iterator() |
int |
lastIndexOf(Object o) |
String |
lastNode() |
ListIterator<String> |
listIterator() |
ListIterator<String> |
listIterator(int index) |
static void |
main(String[] args) |
String |
remove(int index) |
boolean |
remove(Object o) |
boolean |
removeAll(Collection<?> c) |
boolean |
retainAll(Collection<?> c) |
String |
set(int index,
String element) |
int |
size() |
List<String> |
subList(int fromIndex,
int toIndex) |
Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
String |
toString()
Express the search path as a dot separated
String of tokens, which was the original
format provided when this SearchPath instance was constructed. |
static SearchPath |
valueOf(String pSearchPath)
This public static method builds a
SearchPath . |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
replaceAll, sort, spliterator
parallelStream, removeIf, stream
public static SearchPath valueOf(String pSearchPath)
SearchPath
. The format is a dot (.) separated string of tokens, for example:
someNode.innerNode[0].finalNode
The search path specifies what information in the underlying hierarchical data the caller is interested in finding. Notice in the
example above one of the tokens contains square brackets. This is used to indicate if an array-like structure will
be encountered somewhere along the search path.pSearchPath
- - pSearchPathpublic String lastNode()
public static void main(String[] args)
public int size()
public boolean isEmpty()
public boolean contains(Object o)
public Object[] toArray()
public <T> T[] toArray(T[] a)
public boolean add(String s)
public boolean remove(Object o)
public boolean containsAll(Collection<?> c)
containsAll
in interface Collection<String>
containsAll
in interface List<String>
public boolean addAll(Collection<? extends String> c)
public boolean addAll(int index, Collection<? extends String> c)
public boolean removeAll(Collection<?> c)
public boolean retainAll(Collection<?> c)
public void clear()
public int lastIndexOf(Object o)
lastIndexOf
in interface List<String>
public ListIterator<String> listIterator()
listIterator
in interface List<String>
public ListIterator<String> listIterator(int index)
listIterator
in interface List<String>
public String toString()
String
of tokens, which was the original
format provided when this SearchPath
instance was constructed.public boolean equals(Object o)
Copyright © 2019. All rights reserved.