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

hr.com.vgv.verano.http.Dict Maven / Gradle / Ivy

There is a newer version: 0.41
Show newest version
package hr.com.vgv.verano.http;

import java.util.Iterator;

import org.cactoos.Scalar;
import org.cactoos.scalar.StickyScalar;
import org.cactoos.scalar.UncheckedScalar;

/**
 * Dictionary.
 * @author Vedran Vatavuk ([email protected])
 * @version $Id$
 * @since 1.0
 */
public interface Dict extends Iterable {

    String get(String key);

    String get(String key, String def);

    boolean contains(String key);

    class Template implements Dict {

        private final UncheckedScalar origin;

        public Template(Scalar origin)
        {
            this.origin = new UncheckedScalar<>(new StickyScalar<>(origin));
        }

        @Override
        public final String get(String key)
        {
            return this.origin.value().get(key);
        }

        @Override
        public final String get(String key, String def)
        {
            return this.origin.value().get(key, def);
        }

        @Override
        public final boolean contains(String key)
        {
            return this.origin.value().contains(key);
        }

        @Override
        public final Iterator iterator()
        {
            return this.origin.value().iterator();
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy