@Override public PathArgument next() { if (tail != null) { return tail.next(); } final PathArgument ret = identifier.getLastPathArgument(); final YangInstanceIdentifier next = identifier.getParent(); final Iterable<PathArgument> args = next.tryReversePathArguments(); if (args != null) { tail = args.iterator(); identifier = null; } else { verify(next instanceof StackedYangInstanceIdentifier); identifier = (StackedYangInstanceIdentifier) next; } return ret; } }
@Override public PathArgument next() { if (tail != null) { return tail.next(); } final PathArgument ret = identifier.getLastPathArgument(); final YangInstanceIdentifier next = identifier.getParent(); final Iterable<PathArgument> args = next.tryReversePathArguments(); if (args != null) { tail = args.iterator(); identifier = null; } else { verify(next instanceof StackedYangInstanceIdentifier); identifier = (StackedYangInstanceIdentifier) next; } return ret; } }
@Override public List<PathArgument> getPathArguments() { StackedPathArguments ret = tryPathArguments(); if (ret == null) { final List<PathArgument> stack = new ArrayList<>(); YangInstanceIdentifier current = this; do { verify(current instanceof StackedYangInstanceIdentifier); final StackedYangInstanceIdentifier stacked = (StackedYangInstanceIdentifier) current; stack.add(stacked.getLastPathArgument()); current = stacked.getParent(); } while (current.tryPathArguments() == null); ret = new StackedPathArguments(current, Lists.reverse(stack)); pathArguments = ret; } return ret; }
@Override public List<PathArgument> getPathArguments() { StackedPathArguments ret = tryPathArguments(); if (ret == null) { final List<PathArgument> stack = new ArrayList<>(); YangInstanceIdentifier current = this; do { verify(current instanceof StackedYangInstanceIdentifier); final StackedYangInstanceIdentifier stacked = (StackedYangInstanceIdentifier) current; stack.add(stacked.getLastPathArgument()); current = stacked.getParent(); } while (current.tryPathArguments() == null); ret = new StackedPathArguments(current, Lists.reverse(stack)); pathArguments = ret; } return ret; }