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

com.thejohnfreeman.attribute.EarlyBoundAttribute Maven / Gradle / Ivy

Go to download

A library for type-safe, tractable lazy evaluation and late binding in Java.

The newest version!
package com.thejohnfreeman.attribute;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import com.thejohnfreeman.lazy.Lazy;

/**
 * An attribute that is always written before it is read.
 *
 * @author thejohnfreeman
 */
public class EarlyBoundAttribute
    implements Attribute
{
    private final Map> _attrs = new ConcurrentHashMap<>();

    /**
     * {@inheritDoc}
     *
     * 

* May not be called for a node until after its value has been * {@link #put(Object, Lazy)}. */ @Override public Lazy get(final N node) { return _attrs.get(node); } /** * {@inheritDoc} * *

* Must be called before {@link #get(Object)} for the same node. */ @Override public void put(final N node, final Lazy value) { _attrs.put(node, value); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy