app/src/main/java/db/juhaku/juhakudb/core/android/transaction/QueryTransactionTemplate.java
/**
     * Copies given list of elements to collection of given class type. Class type must be assignable
     * from {@link Collection} class.
     *
     * @param result List of elements to copy.
     * @param type Instance of collection {@link Class}.
     * @return Collection of elements with type of given collection class.
     *
     * @since 2.0.0
     *
     * @hide
     */
Copies given list of elements to collection of given class type. Class type must be assignable
from  Collection class.

@param result List of elements to copy.
@param type Instance of collection  Class.
@return Collection of elements with type of given collection class.



@hide
Copies given list of elements to collection of given class type . Class type must be assignable from Collection class . @param result List of elements to copy . @param type Instance of collection Class . @return Collection of elements with type of given collection class . @hide
private <E> Collection<E> resultsToCollection(List<E> result, Class<?> type) {
        if (Set.class.isAssignableFrom(type)) {
            if (HashSet.class.isAssignableFrom(type)) {
                return new HashSet<>(result);
            } else if (TreeSet.class.isAssignableFrom(type)) {
                return new TreeSet<>(result);
            } else {
                throw new MappingException("Given type does not inherit: " + HashSet.class.getName() + " nor " + TreeSet.class.getName());
            }
        }
        if (List.class.isAssignableFrom(type)) {
            if (LinkedList.class.isAssignableFrom(type)) {
                return new LinkedList<>(result);
            } else {
                return new ArrayList<>(result);
            }
        }
        return null;
    }
private < E > Collection < E > resultsToCollection ( List < E > result , Class < ? > type ) { if ( Set . class . isAssignableFrom ( type ) ) { if ( HashSet . class . isAssignableFrom ( type ) ) { return new HashSet < > ( result ) ; } else if ( TreeSet . class . isAssignableFrom ( type ) ) { return new TreeSet < > ( result ) ; } else { throw new MappingException ( "Given type does not inherit: " + HashSet . class . getName ( ) + " nor " + TreeSet . class . getName ( ) ) ; } } if ( List . class . isAssignableFrom ( type ) ) { if ( LinkedList . class . isAssignableFrom ( type ) ) { return new LinkedList < > ( result ) ; } else { return new ArrayList < > ( result ) ; } } return null ; }
Copies given list of elements to collection of given class type.
Copies given list of elements to collection of given class type .