public default <A> A get(final Pop pop, final String label) throws IllegalArgumentException {
        if (Pop.mixed == pop) {
            return this.get(label);
        } else if (Pop.all == pop) {
            if (this.hasLabel(label)) {
                final Object object = this.get(label);
                if (object instanceof List)
                    return (A) object;
                else
                    return (A) Collections.singletonList(object);
            } else {
                return (A) Collections.emptyList();
            }
        } else {
            final Object object = this.get(label);
            if (object instanceof List) {
                return Pop.last == pop ? ((List<A>) object).get(((List) object).size() - 1) : ((List<A>) object).get(0);
            } else
                return (A) object;
        }
    }
Pop the object(s) associated with the label of the path.

@param pop   first for least recent, last for most recent, and all for all in a list
@param label the label of the path
@param <A>   the type of the object associated with the label
@return the object associated with the label of the path
@throws IllegalArgumentException if the path does not contain the label
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/Path.java