Android XML NodeList Length Check nodeLength(NodeList list)

Here you can find the source of nodeLength(NodeList list)

Description

Returns the length of the specified node list.

License

Open Source License

Parameter

Parameter Description
list The node list to measure.

Return

The length of the specified node list.

Declaration

public static int nodeLength(NodeList list) 

Method Source Code

//package com.java2s;
/*/*from  w  ww .j a v a 2 s.  c om*/
 * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License").
 * You may not use this file except in compliance with the License.
 * A copy of the License is located at
 *
 *  http://aws.amazon.com/apache2.0
 *
 * or in the "license" file accompanying this file. This file is distributed
 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
 * express or implied. See the License for the specific language governing
 * permissions and limitations under the License.
 */

import org.w3c.dom.NodeList;

public class Main {
    /**
     * Returns the length of the specified node list.
     *
     * @param list
     *            The node list to measure.
     *
     * @return The length of the specified node list.
     */
    public static int nodeLength(NodeList list) {
        return list == null ? 0 : list.getLength();
    }
}