Search in sources :

Example 1 with InvalidResultException

use of org.jooq.exception.InvalidResultException in project jOOQ by jOOQ.

the class ResultImpl method intoMap.

@Override
public final <K, V> Map<K, V> intoMap(RecordMapper<? super R, K> keyMapper, RecordMapper<? super R, V> valueMapper) {
    Map<K, V> map = new LinkedHashMap<K, V>();
    for (R record : this) {
        K key = keyMapper.map(record);
        V value = valueMapper.map(record);
        if (map.put(key, value) != null)
            throw new InvalidResultException("Key list " + key + " is not unique in Result for " + this);
    }
    return map;
}
Also used : InvalidResultException(org.jooq.exception.InvalidResultException) LinkedHashMap(java.util.LinkedHashMap)

Aggregations

LinkedHashMap (java.util.LinkedHashMap)1 InvalidResultException (org.jooq.exception.InvalidResultException)1