/** * Generates an array of entries from a map. Entries are defined in the API as * a class which consists of a {@code key} and {@code value} with a name * typically in the form of {@code Key_ValueMapEntry}, represented here as * {@code T}. The generated array can be used in objects where {@code * List<Key_ValueMapEntry>} is taken as a value. The input map must have same type * {@code K} as the {@code key} within {@code Key_ValueMapEntry}. The same * applies for {@code V} and {@code value} within {@code Key_ValueMapEntry}. * * @param <K> the type of the entry key * @param <V> the type of the entry value * @param <T> the map entry type * @param map a map of type {@code K} and {@code V} representing the entry * array * @param entryArray the entry array that entries will be added into * @return an array all map entries contained within the map parameter into * the provided array or a new array if there was not enough room */ public static <K, V, T> T[] toArray(Map<K, V> map, T[] entryArray) { return toList(map, entryArray.getClass().getComponentType()).toArray(entryArray); }
/** * Generates an array of entries from a map. Entries are defined in the API as * a class which consists of a {@code key} and {@code value} with a name * typically in the form of {@code Key_ValueMapEntry}, represented here as * {@code T}. The generated array can be used in objects where {@code * List<Key_ValueMapEntry>} is taken as a value. The input map must have same type * {@code K} as the {@code key} within {@code Key_ValueMapEntry}. The same * applies for {@code V} and {@code value} within {@code Key_ValueMapEntry}. * * @param <K> the type of the entry key * @param <V> the type of the entry value * @param <T> the map entry type * @param map a map of type {@code K} and {@code V} representing the entry * array * @param entryArray the entry array that entries will be added into * @return an array all map entries contained within the map parameter into * the provided array or a new array if there was not enough room */ public static <K, V, T> T[] toArray(Map<K, V> map, T[] entryArray) { return toList(map, entryArray.getClass().getComponentType()).toArray(entryArray); }
/** * Gets the {@link Statement} representing the state of this statement * builder. * * @return the {@link Statement} */ public Statement toStatement() { Statement statement = new Statement(); statement.setQuery(queryBuilder.buildQuery()); statement.setValues(Maps.toList(queryBuilder.getBindVariableMap(), String_ValueMapEntry.class) .toArray(new String_ValueMapEntry[] {})); return statement; }
/** * Gets the {@link Statement} representing the state of this statement builder. * * @return the {@link Statement} */ public Statement toStatement() { Statement statement = new Statement(); statement.setQuery(queryBuilder.buildQuery()); statement .getValues() .addAll(Maps.toList(queryBuilder.getBindVariableMap(), StringValueMapEntry.class)); return statement; }
/** * Gets the {@link Statement} representing the state of this statement * builder. * * @return the {@link Statement} */ public Statement toStatement() { Statement statement = new Statement(); statement.setQuery(queryBuilder.buildQuery()); statement.getValues().addAll( Maps.toList(queryBuilder.getBindVariableMap(), StringValueMapEntry.class)); return statement; }
/** * Gets the {@link Statement} representing the state of this statement * builder. * * @return the {@link Statement} */ public Statement toStatement() { Statement statement = new Statement(); statement.setQuery(queryBuilder.buildQuery()); statement.setValues(Maps.toList(queryBuilder.getBindVariableMap(), String_ValueMapEntry.class) .toArray(new String_ValueMapEntry[] {})); return statement; }
/** * Gets the {@link Statement} representing the state of this statement * builder. * * @return the {@link Statement} */ public Statement toStatement() { Statement statement = new Statement(); statement.setQuery(queryBuilder.buildQuery()); statement.getValues().addAll( Maps.toList(queryBuilder.getBindVariableMap(), StringValueMapEntry.class)); return statement; }
/** * Gets the {@link Statement} representing the state of this statement * builder. * * @return the {@link Statement} */ public Statement toStatement() { Statement statement = new Statement(); statement.setQuery(queryBuilder.buildQuery()); statement.getValues().addAll( Maps.toList(queryBuilder.getBindVariableMap(), StringValueMapEntry.class)); return statement; }
/** * Gets the {@link Statement} representing the state of this statement builder. * * @return the {@link Statement} */ public Statement toStatement() { Statement statement = new Statement(); statement.setQuery(queryBuilder.buildQuery()); statement.setValues( Maps.toList(queryBuilder.getBindVariableMap(), String_ValueMapEntry.class) .toArray(new String_ValueMapEntry[] {})); return statement; }
/** * Gets the {@link Statement} representing the state of this statement * builder. * * @return the {@link Statement} */ public Statement toStatement() { Statement statement = new Statement(); statement.setQuery(queryBuilder.buildQuery()); statement.setValues(Maps.toList(queryBuilder.getBindVariableMap(), String_ValueMapEntry.class) .toArray(new String_ValueMapEntry[] {})); return statement; }
@Test public void testToList() { List<Entry> actualList = Maps.toList(entriesMap, Entry.class); assertEquals(entriesList, actualList); }