Class MutableScopedDataSet

    • Method Detail

      • getOrCompute

        @Nullable
        public java.lang.Object getOrCompute​(@NotNull
                                             DataKeyBase<?> key,
                                             @NotNull
                                             DataValueFactory<?> factory)
        Description copied from interface: DataHolder
        Get key if it exists or compute using supplier

        Method used by DataKey classes to access data.

        NOTE: MutableDataHolders will compute an absent key and add it to its dataSet. DataHolders will return computed value but not change contained dataSet because they are immutable. So value will be computed every time it is requested.

        Specified by:
        getOrCompute in interface DataHolder
        Specified by:
        getOrCompute in interface MutableDataHolder
        Overrides:
        getOrCompute in class MutableDataSet
        Parameters:
        key - data key
        factory - factory taking this data holder and computing/providing default value
        Returns:
        object value for the key