All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.umlg.java.metamodel.utilities.JavaUtil Maven / Gradle / Ivy

/** (c) Copyright 2002, Klasse Objecten
 */
package org.umlg.java.metamodel.utilities;

import java.util.Collection;
import java.util.Iterator;

import org.umlg.java.metamodel.OJElement;

public class JavaUtil {
    public JavaUtil() {
    }

    static public String collectionToJavaString(Collection coll, String separator) {
        if (coll == null) {
            return "";
        }
        StringBuilder result = new StringBuilder();
        if (coll != null) {
            Iterator i = coll.iterator();
            while (i.hasNext()) {
                OJElement o = i.next();
                result = result.append(o == null ? "" : o.toJavaString());
                if (i.hasNext())
                    result = result.append(separator);
            }
        }
        return result.toString();
    }

    static public String collectionToString(Collection coll, String separator) {
        if (coll == null) {
            return "";
        }
        String result = "";
        if (coll != null) {
            Iterator i = coll.iterator();
            while (i.hasNext()) {
                Object o = i.next();
                result = result + (o == null ? "" : o.toString());
                if (i.hasNext())
                    result = result + separator;
            }
        }
        return result;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy