static Map<Keyword, Object> toKeywordMap(Event event) { Map<String, Object> rawStringMap = OBJECT_MAPPER.convertValue(event, new TypeReference<Map<String, ?>>() {}); return EntryStream.of(rawStringMap) .filterValues(Objects::nonNull) .mapKeys(Keyword::intern) .toMap(); }
/** * Returns a stream consisting of the elements of this stream which values * don't match the given predicate. * * <p> * This is an <a href="package-summary.html#StreamOps">intermediate</a> * operation. * * @param valuePredicate a non-interfering, stateless predicate to apply to * the value of each element to determine if it should be excluded * @return the new stream */ public EntryStream<K, V> removeValues(Predicate<? super V> valuePredicate) { return filterValues(valuePredicate.negate()); }
/** * Returns a sequential {@code StreamEx} of given {@link Map} keys which * corresponding values match the supplied filter. * * @param <T> the type of map keys and created stream elements * @param <V> the type of map values * @param map input map * @param valueFilter a predicate used to test values * @return a sequential {@code StreamEx} over the keys of given {@code Map} * which corresponding values match the supplied filter. * @throws NullPointerException if map is null * @see Map#keySet() */ public static <T, V> StreamEx<T> ofKeys(Map<T, V> map, Predicate<? super V> valueFilter) { return EntryStream.of(map).filterValues(valueFilter).keys(); }