
com.github.valid8j.pcond.experimentals.currying.context.CurriedContext Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of valid8j Show documentation
Show all versions of valid8j Show documentation
Java Library Providing Uniformed Programming Experiences across DbC, Value Checking, and Test Assertions
The newest version!
package com.github.valid8j.pcond.experimentals.currying.context;
import com.github.valid8j.pcond.internals.InternalUtils;
import java.util.Formattable;
import java.util.Formatter;
import java.util.List;
import static java.util.Collections.singletonList;
/**
* `Context` is a concept to handle multiple values in the `pcond`.
*/
public interface CurriedContext extends Formattable {
/**
* Returns the number of context values.
*
* @return The number of context values.
*/
default int size() {
return values().size();
}
/**
* Returns the context value specified by the index.
*
* @param i The index of the context value to be returned.
* @param Expected type of the returned context value.
* @return The specified context value.
*/
@SuppressWarnings("unchecked")
default T valueAt(int i) {
return (T) values().get(i);
}
/**
* Creates a new context with an appended value.
*
* @param o A value to appended
* @return A new context with the appended value.
*/
default CurriedContext append(Object o) {
return new CurriedContext() {
@Override
public List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy