Java Scanner Usage iterate(final String node)

Here you can find the source of iterate(final String node)

Description

Returns an Iterable over a node's path components.

License

Open Source License

Parameter

Parameter Description
node A tree-node's full path.

Return

An over a node's path components.

Declaration

public static Iterable<String> iterate(final String node) 

Method Source Code

//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("/");
            }
        };
    }
}

Related

  1. input(String prompt)
  2. isInteger(String s)
  3. isNumeric(String str)
  4. isValueValid(String value, String pattern)
  5. isYes(String str)
  6. joinSqlStatements(Collection scripts)
  7. leerOpcion(String opciones, String msgUsr, String msgErr)
  8. leerTexto(String msgUsr)
  9. listify(String s, String prefix, String... ignorelist)