Here you can find the source of iterate(final String node)
Parameter | Description |
---|---|
node | A tree-node's full path. |
public static Iterable<String> iterate(final String node)
//package com.java2s; /*//from www . j a v a2 s . c o m * Galaxy * Copyright (c) 2012-2014, Parallel Universe Software Co. All rights reserved. * * This program and the accompanying materials are dual-licensed under * either the terms of the Eclipse Public License v1.0 as published by * the Eclipse Foundation * * or (per the licensee's choosing) * * under the terms of the GNU Lesser General Public License version 3.0 * as published by the Free Software Foundation. */ import java.util.Iterator; import java.util.Scanner; public class Main { /** * Returns an {@link Iterable} over a node's path components. * @param node A tree-node's full path. * @return An {@link Iterable} over a node's path components. */ public static Iterable<String> iterate(final String node) { return new Iterable<String>() { @Override public Iterator<String> iterator() { return new Scanner(node).useDelimiter("/"); } }; } }