24 package org.lightjason.agentspeak.action.builtin.collection.map;
26 import com.codepoetics.protonpack.StreamUtils;
35 import javax.annotation.Nonnull;
36 import java.util.HashMap;
37 import java.util.List;
39 import java.util.concurrent.ConcurrentHashMap;
40 import java.util.stream.Collectors;
69 @Nonnull
final List<ITerm> p_argument, @Nonnull
final List<ITerm> p_return
72 final List<ITerm> l_arguments =
CCommon.
flatten( p_argument ).collect( Collectors.toList() );
73 if ( ( l_arguments.size() > 0 ) && ( l_arguments.size() % 2 == 1 ) )
76 final Map<Object, Object> l_map = p_parallel ?
new ConcurrentHashMap<>() :
new HashMap<>();
77 StreamUtils.windowed( l_arguments.stream(), 2, 2 )
78 .forEach( i -> l_map.put( i.get( 0 ).raw(), i.get( 1 ).raw() ) );
base class of build-in actions for setting name by package/classname (without prefix character) ...
static< N > IFuzzyValue< N > from( @Nonnull final N p_value)
factory
common structure for execution definition
static final long serialVersionUID
serial id
execution context with local data
static Stream< ITerm > flatten( @Nonnull final Collection<? extends ITerm > p_terms)
flat term-in-term collection into a straight term list
result for an immutable fuzzy value
final IFuzzyValue< Boolean > execute(final boolean p_parallel, @Nonnull final IContext p_context, @Nonnull final List< ITerm > p_argument, @Nonnull final List< ITerm > p_return)
defines a plan-body operation
static< N > CRawTerm< N > from(final N p_value)
factory for a raw term
term structure for simple datatypes