public static class VObjectPropertyValues.StructuredValueIterator extends Object
Helper class for iterating over the values in a "structured" property value.
Structured values are essentially 2-D arrays. They contain multiple components separated by semicolons, and each component can have multiple values separated by commas. The order that the components are in matters, but the order that each component's list of values are in usually doesn't matter.
Example:
String value = "one;two,three;;;four"; StructuredValueIterator it = new StructuredValueIterator(value); assertEquals(Arrays.asList("one"), it.nextComponent()); assertEquals(Arrays.asList("two", "three"), it.nextComponent()); assertEquals(Arrays.asList(), it.nextComponent()); assertNull(it.nextValue()); assertEquals("four", it.nextValue()); assertFalse(it.hasNext());
Constructor and Description |
---|
StructuredValueIterator(List<List<String>> components)
Constructs a new structured value iterator.
|
StructuredValueIterator(String string)
Constructs a new structured value iterator.
|
Modifier and Type | Method and Description |
---|---|
boolean |
hasNext() |
List<String> |
nextComponent()
Gets the next component.
|
String |
nextValue()
Gets the first value of the next component.
|
public StructuredValueIterator(String string)
string
- the structured value to parsepublic StructuredValueIterator(List<List<String>> components)
components
- the components to iterator overpublic String nextValue()
public List<String> nextComponent()
public boolean hasNext()
Copyright © 2016–2018 Michael Angstadt. All rights reserved.