Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    /**
     * Checks if a node name equals a particular name, regardless of prefix.
     * NOTE: If checking names containing subsets of others using case or if else statements,
     *        start with one which is not contained by others. 
     *       e.g "itemset" should be before "item".
     * 
     * @param nodeName the node name.
     * @param name the name to compare with.
     * @return true if they are the same, else false.
     */
    public static boolean nodeNameEquals(String nodeName, String name) {
        return nodeName.equals(name) || nodeName.contains(":" + name);

    }
}