Java Code Examples for org.cactoos.Scalar#value()
The following examples show how to use
org.cactoos.Scalar#value() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PhonesSql.java From cactoos-jdbc with MIT License | 6 votes |
@Override public Phone get(final int index) throws Exception { final Scalar<String> number = new ResultSetAsValue<>( new StatementSelect( this.session, new QuerySimple( new FormattedText( new Joined( " ", "SELECT number FROM phone WHERE", "contact_id = :contact_id", "FETCH FIRST %d ROWS ONLY" ), index ) ) ) ); return new PhoneSql(this.session, this.id, number.value()); }
Example 2
Source File: Ternary.java From cactoos with MIT License | 5 votes |
@Override public T value() throws Exception { final Scalar<T> result; if (this.condition.value()) { result = this.consequent; } else { result = this.alternative; } return result.value(); }
Example 3
Source File: Or.java From cactoos with MIT License | 5 votes |
@Override public Boolean value() throws Exception { boolean result = false; for (final Scalar<Boolean> item : this.origin) { if (item.value()) { result = true; break; } } return result; }
Example 4
Source File: And.java From cactoos with MIT License | 5 votes |
@Override public Boolean value() throws Exception { boolean result = true; for (final Scalar<Boolean> item : this.origin) { if (!item.value()) { result = false; break; } } return result; }
Example 5
Source File: DictInput.java From verano-http with MIT License | 4 votes |
/** * Ctor. * @param input Dictionary input */ public Envelope(final Scalar<DictInput> input) { this( (Dict dict) -> new JoinedDict(dict, new DictOf(input.value())) ); }
Example 6
Source File: FuncOf.java From cactoos with MIT License | 4 votes |
/** * Ctor. * @param scalar Origin scalar */ public FuncOf(final Scalar<Y> scalar) { this(input -> { return scalar.value(); }); }
Example 7
Source File: Sticky.java From cactoos with MIT License | 4 votes |
/** * Ctor. * @param scalar The Scalar to cache */ public Sticky(final Scalar<T> scalar) { this.func = new StickyFunc<>( input -> scalar.value() ); }
Example 8
Source File: BiFuncOf.java From cactoos with MIT License | 2 votes |
/** * Ctor. * @param scalar The scalar */ public BiFuncOf(final Scalar<Z> scalar) { this((first, second) -> scalar.value()); }