Code example for LinkedList

Methods: toArray

0
segments.addLast(segment);
	} 
 
	public TreePath getPath() { 
		return new TreePath(segments.toArray());
	} 
 
	public TreePath getParentPath() { 
		LinkedList parentSegments = new LinkedList<Object>(segments);
		parentSegments.removeLast();
		return new TreePath(parentSegments.toArray());
	} 
 
	public Object getLastSegment() {
		return segments.getLast();
	} 
 
	public Object getFirstSegment() {
		return segments.getFirst();
	}