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

com.sap.it.commons.lang.LangTools Maven / Gradle / Ivy

package com.sap.it.commons.lang;

import java.util.Enumeration;
import java.util.Iterator;

public class LangTools {

    private LangTools() {
    }

    private final static class IteratorAsEnumeration implements Enumeration {
        private final Iterator iterator;

        public IteratorAsEnumeration(Iterator iterator) {
            this.iterator = Checks.nonNullArgument(iterator, "iterator must not be null");
        }

        @Override
        public boolean hasMoreElements() {
            return iterator.hasNext();
        }

        @Override
        public T nextElement() {
            return iterator.next();
        }
    }

    public static  Enumeration asEnumeration(Iterator iterator) {
        return new IteratorAsEnumeration(iterator);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy