target
stringlengths
20
113k
src_fm
stringlengths
11
86.3k
src_fm_fc
stringlengths
21
86.4k
src_fm_fc_co
stringlengths
30
86.4k
src_fm_fc_ms
stringlengths
42
86.8k
src_fm_fc_ms_ff
stringlengths
43
86.8k
@Test public void forEachButLast() { final List<Integer> listA = new ArrayList<Integer>(); listA.add(1); final List<Integer> listB = new ArrayList<Integer>(); listB.add(2); final Closure<List<Integer>> testClosure = ClosureUtils.invokerClosure("clear"); final Collection<List<Integer>> col = new ArrayList<List<Integer>>...
public static <E> E forEachButLast(final Iterable<E> iterable, final Closure<? super E> closure) { return IteratorUtils.forEachButLast(emptyIteratorIfNull(iterable), closure); }
IterableUtils { public static <E> E forEachButLast(final Iterable<E> iterable, final Closure<? super E> closure) { return IteratorUtils.forEachButLast(emptyIteratorIfNull(iterable), closure); } }
IterableUtils { public static <E> E forEachButLast(final Iterable<E> iterable, final Closure<? super E> closure) { return IteratorUtils.forEachButLast(emptyIteratorIfNull(iterable), closure); } }
IterableUtils { public static <E> E forEachButLast(final Iterable<E> iterable, final Closure<? super E> closure) { return IteratorUtils.forEachButLast(emptyIteratorIfNull(iterable), closure); } @SuppressWarnings("unchecked") // OK, empty collection is compatible with any type static Iterable<E> emptyIterable(); @Suppr...
IterableUtils { public static <E> E forEachButLast(final Iterable<E> iterable, final Closure<? super E> closure) { return IteratorUtils.forEachButLast(emptyIteratorIfNull(iterable), closure); } @SuppressWarnings("unchecked") // OK, empty collection is compatible with any type static Iterable<E> emptyIterable(); @Suppr...
@Test public void containsWithEquator() { final List<String> base = new ArrayList<String>(); base.add("AC"); base.add("BB"); base.add("CA"); final Equator<String> secondLetterEquator = new Equator<String>() { @Override public boolean equate(String o1, String o2) { return o1.charAt(1) == o2.charAt(1); } @Override public...
public static <E> boolean contains(final Iterable<E> iterable, final Object object) { if (iterable instanceof Collection<?>) { return ((Collection<E>) iterable).contains(object); } else { return IteratorUtils.contains(emptyIteratorIfNull(iterable), object); } }
IterableUtils { public static <E> boolean contains(final Iterable<E> iterable, final Object object) { if (iterable instanceof Collection<?>) { return ((Collection<E>) iterable).contains(object); } else { return IteratorUtils.contains(emptyIteratorIfNull(iterable), object); } } }
IterableUtils { public static <E> boolean contains(final Iterable<E> iterable, final Object object) { if (iterable instanceof Collection<?>) { return ((Collection<E>) iterable).contains(object); } else { return IteratorUtils.contains(emptyIteratorIfNull(iterable), object); } } }
IterableUtils { public static <E> boolean contains(final Iterable<E> iterable, final Object object) { if (iterable instanceof Collection<?>) { return ((Collection<E>) iterable).contains(object); } else { return IteratorUtils.contains(emptyIteratorIfNull(iterable), object); } } @SuppressWarnings("unchecked") // OK, emp...
IterableUtils { public static <E> boolean contains(final Iterable<E> iterable, final Object object) { if (iterable instanceof Collection<?>) { return ((Collection<E>) iterable).contains(object); } else { return IteratorUtils.contains(emptyIteratorIfNull(iterable), object); } } @SuppressWarnings("unchecked") // OK, emp...
@Test public void frequency() { assertEquals(0, IterableUtils.frequency(null, 1)); assertEquals(1, IterableUtils.frequency(iterableA, 1)); assertEquals(2, IterableUtils.frequency(iterableA, 2)); assertEquals(3, IterableUtils.frequency(iterableA, 3)); assertEquals(4, IterableUtils.frequency(iterableA, 4)); assertEquals(...
public static <E, T extends E> int frequency(final Iterable<E> iterable, final T obj) { if (iterable instanceof Set<?>) { return ((Set<E>) iterable).contains(obj) ? 1 : 0; } if (iterable instanceof Bag<?>) { return ((Bag<E>) iterable).getCount(obj); } return size(filteredIterable(emptyIfNull(iterable), EqualPredicate.<...
IterableUtils { public static <E, T extends E> int frequency(final Iterable<E> iterable, final T obj) { if (iterable instanceof Set<?>) { return ((Set<E>) iterable).contains(obj) ? 1 : 0; } if (iterable instanceof Bag<?>) { return ((Bag<E>) iterable).getCount(obj); } return size(filteredIterable(emptyIfNull(iterable), ...
IterableUtils { public static <E, T extends E> int frequency(final Iterable<E> iterable, final T obj) { if (iterable instanceof Set<?>) { return ((Set<E>) iterable).contains(obj) ? 1 : 0; } if (iterable instanceof Bag<?>) { return ((Bag<E>) iterable).getCount(obj); } return size(filteredIterable(emptyIfNull(iterable), ...
IterableUtils { public static <E, T extends E> int frequency(final Iterable<E> iterable, final T obj) { if (iterable instanceof Set<?>) { return ((Set<E>) iterable).contains(obj) ? 1 : 0; } if (iterable instanceof Bag<?>) { return ((Bag<E>) iterable).getCount(obj); } return size(filteredIterable(emptyIfNull(iterable), ...
IterableUtils { public static <E, T extends E> int frequency(final Iterable<E> iterable, final T obj) { if (iterable instanceof Set<?>) { return ((Set<E>) iterable).contains(obj) ? 1 : 0; } if (iterable instanceof Bag<?>) { return ((Bag<E>) iterable).getCount(obj); } return size(filteredIterable(emptyIfNull(iterable), ...
@Test public void frequencyOfNull() { final List<String> list = new ArrayList<String>(); assertEquals(0, IterableUtils.frequency(list, null)); list.add("A"); assertEquals(0, IterableUtils.frequency(list, null)); list.add(null); assertEquals(1, IterableUtils.frequency(list, null)); list.add("B"); assertEquals(1, Iterabl...
public static <E, T extends E> int frequency(final Iterable<E> iterable, final T obj) { if (iterable instanceof Set<?>) { return ((Set<E>) iterable).contains(obj) ? 1 : 0; } if (iterable instanceof Bag<?>) { return ((Bag<E>) iterable).getCount(obj); } return size(filteredIterable(emptyIfNull(iterable), EqualPredicate.<...
IterableUtils { public static <E, T extends E> int frequency(final Iterable<E> iterable, final T obj) { if (iterable instanceof Set<?>) { return ((Set<E>) iterable).contains(obj) ? 1 : 0; } if (iterable instanceof Bag<?>) { return ((Bag<E>) iterable).getCount(obj); } return size(filteredIterable(emptyIfNull(iterable), ...
IterableUtils { public static <E, T extends E> int frequency(final Iterable<E> iterable, final T obj) { if (iterable instanceof Set<?>) { return ((Set<E>) iterable).contains(obj) ? 1 : 0; } if (iterable instanceof Bag<?>) { return ((Bag<E>) iterable).getCount(obj); } return size(filteredIterable(emptyIfNull(iterable), ...
IterableUtils { public static <E, T extends E> int frequency(final Iterable<E> iterable, final T obj) { if (iterable instanceof Set<?>) { return ((Set<E>) iterable).contains(obj) ? 1 : 0; } if (iterable instanceof Bag<?>) { return ((Bag<E>) iterable).getCount(obj); } return size(filteredIterable(emptyIfNull(iterable), ...
IterableUtils { public static <E, T extends E> int frequency(final Iterable<E> iterable, final T obj) { if (iterable instanceof Set<?>) { return ((Set<E>) iterable).contains(obj) ? 1 : 0; } if (iterable instanceof Bag<?>) { return ((Bag<E>) iterable).getCount(obj); } return size(filteredIterable(emptyIfNull(iterable), ...
@Test public void find() { Predicate<Number> testPredicate = equalPredicate((Number) 4); Integer test = IterableUtils.find(iterableA, testPredicate); assertTrue(test.equals(4)); testPredicate = equalPredicate((Number) 45); test = IterableUtils.find(iterableA, testPredicate); assertTrue(test == null); assertNull(Iterabl...
public static <E> E find(final Iterable<E> iterable, final Predicate<? super E> predicate) { return IteratorUtils.find(emptyIteratorIfNull(iterable), predicate); }
IterableUtils { public static <E> E find(final Iterable<E> iterable, final Predicate<? super E> predicate) { return IteratorUtils.find(emptyIteratorIfNull(iterable), predicate); } }
IterableUtils { public static <E> E find(final Iterable<E> iterable, final Predicate<? super E> predicate) { return IteratorUtils.find(emptyIteratorIfNull(iterable), predicate); } }
IterableUtils { public static <E> E find(final Iterable<E> iterable, final Predicate<? super E> predicate) { return IteratorUtils.find(emptyIteratorIfNull(iterable), predicate); } @SuppressWarnings("unchecked") // OK, empty collection is compatible with any type static Iterable<E> emptyIterable(); @SuppressWarnings("u...
IterableUtils { public static <E> E find(final Iterable<E> iterable, final Predicate<? super E> predicate) { return IteratorUtils.find(emptyIteratorIfNull(iterable), predicate); } @SuppressWarnings("unchecked") // OK, empty collection is compatible with any type static Iterable<E> emptyIterable(); @SuppressWarnings("u...
@Test public void indexOf() { Predicate<Number> testPredicate = equalPredicate((Number) 4); int index = IterableUtils.indexOf(iterableA, testPredicate); assertEquals(6, index); testPredicate = equalPredicate((Number) 45); index = IterableUtils.indexOf(iterableA, testPredicate); assertEquals(-1, index); assertEquals(-1,...
public static <E> int indexOf(final Iterable<E> iterable, final Predicate<? super E> predicate) { return IteratorUtils.indexOf(emptyIteratorIfNull(iterable), predicate); }
IterableUtils { public static <E> int indexOf(final Iterable<E> iterable, final Predicate<? super E> predicate) { return IteratorUtils.indexOf(emptyIteratorIfNull(iterable), predicate); } }
IterableUtils { public static <E> int indexOf(final Iterable<E> iterable, final Predicate<? super E> predicate) { return IteratorUtils.indexOf(emptyIteratorIfNull(iterable), predicate); } }
IterableUtils { public static <E> int indexOf(final Iterable<E> iterable, final Predicate<? super E> predicate) { return IteratorUtils.indexOf(emptyIteratorIfNull(iterable), predicate); } @SuppressWarnings("unchecked") // OK, empty collection is compatible with any type static Iterable<E> emptyIterable(); @SuppressWar...
IterableUtils { public static <E> int indexOf(final Iterable<E> iterable, final Predicate<? super E> predicate) { return IteratorUtils.indexOf(emptyIteratorIfNull(iterable), predicate); } @SuppressWarnings("unchecked") // OK, empty collection is compatible with any type static Iterable<E> emptyIterable(); @SuppressWar...
@Test public void testIntercept() throws Exception { final String sql = "select * from user where id=? and name=?"; BoundSql boundSql = new BoundSql(sql); boundSql.addArg(1); boundSql.addArg("ash"); final User user = new User(); user.setId(100); user.setName("lucy"); InterceptorChain ic = new InterceptorChain(); ic.add...
public void intercept(BoundSql boundSql, InvocationContext context, DataSource dataSource) { if (interceptorChain.getInterceptors() != null) { List<Object> parameterValues = context.getParameterValues(); List<Parameter> parameters = new ArrayList<Parameter>(parameterValues.size()); for (int i = 0; i < parameterValues.s...
InvocationInterceptorChain { public void intercept(BoundSql boundSql, InvocationContext context, DataSource dataSource) { if (interceptorChain.getInterceptors() != null) { List<Object> parameterValues = context.getParameterValues(); List<Parameter> parameters = new ArrayList<Parameter>(parameterValues.size()); for (int...
InvocationInterceptorChain { public void intercept(BoundSql boundSql, InvocationContext context, DataSource dataSource) { if (interceptorChain.getInterceptors() != null) { List<Object> parameterValues = context.getParameterValues(); List<Parameter> parameters = new ArrayList<Parameter>(parameterValues.size()); for (int...
InvocationInterceptorChain { public void intercept(BoundSql boundSql, InvocationContext context, DataSource dataSource) { if (interceptorChain.getInterceptors() != null) { List<Object> parameterValues = context.getParameterValues(); List<Parameter> parameters = new ArrayList<Parameter>(parameterValues.size()); for (int...
InvocationInterceptorChain { public void intercept(BoundSql boundSql, InvocationContext context, DataSource dataSource) { if (interceptorChain.getInterceptors() != null) { List<Object> parameterValues = context.getParameterValues(); List<Parameter> parameters = new ArrayList<Parameter>(parameterValues.size()); for (int...
@Test public void countMatches() { assertEquals(4, IterableUtils.countMatches(iterableB, EQUALS_TWO)); assertEquals(0, IterableUtils.countMatches(null, EQUALS_TWO)); try { assertEquals(0, IterableUtils.countMatches(iterableA, null)); fail("predicate must not be null"); } catch (NullPointerException ex) { } try { assert...
public static <E> long countMatches(final Iterable<E> input, final Predicate<? super E> predicate) { if (predicate == null) { throw new NullPointerException("Predicate must not be null."); } return size(filteredIterable(emptyIfNull(input), predicate)); }
IterableUtils { public static <E> long countMatches(final Iterable<E> input, final Predicate<? super E> predicate) { if (predicate == null) { throw new NullPointerException("Predicate must not be null."); } return size(filteredIterable(emptyIfNull(input), predicate)); } }
IterableUtils { public static <E> long countMatches(final Iterable<E> input, final Predicate<? super E> predicate) { if (predicate == null) { throw new NullPointerException("Predicate must not be null."); } return size(filteredIterable(emptyIfNull(input), predicate)); } }
IterableUtils { public static <E> long countMatches(final Iterable<E> input, final Predicate<? super E> predicate) { if (predicate == null) { throw new NullPointerException("Predicate must not be null."); } return size(filteredIterable(emptyIfNull(input), predicate)); } @SuppressWarnings("unchecked") // OK, empty coll...
IterableUtils { public static <E> long countMatches(final Iterable<E> input, final Predicate<? super E> predicate) { if (predicate == null) { throw new NullPointerException("Predicate must not be null."); } return size(filteredIterable(emptyIfNull(input), predicate)); } @SuppressWarnings("unchecked") // OK, empty coll...
@Test public void matchesAny() { final List<Integer> list = new ArrayList<Integer>(); try { assertFalse(IterableUtils.matchesAny(null, null)); fail("predicate must not be null"); } catch (NullPointerException ex) { } try { assertFalse(IterableUtils.matchesAny(list, null)); fail("predicate must not be null"); } catch (N...
public static <E> boolean matchesAny(final Iterable<E> iterable, final Predicate<? super E> predicate) { return IteratorUtils.matchesAny(emptyIteratorIfNull(iterable), predicate); }
IterableUtils { public static <E> boolean matchesAny(final Iterable<E> iterable, final Predicate<? super E> predicate) { return IteratorUtils.matchesAny(emptyIteratorIfNull(iterable), predicate); } }
IterableUtils { public static <E> boolean matchesAny(final Iterable<E> iterable, final Predicate<? super E> predicate) { return IteratorUtils.matchesAny(emptyIteratorIfNull(iterable), predicate); } }
IterableUtils { public static <E> boolean matchesAny(final Iterable<E> iterable, final Predicate<? super E> predicate) { return IteratorUtils.matchesAny(emptyIteratorIfNull(iterable), predicate); } @SuppressWarnings("unchecked") // OK, empty collection is compatible with any type static Iterable<E> emptyIterable(); @S...
IterableUtils { public static <E> boolean matchesAny(final Iterable<E> iterable, final Predicate<? super E> predicate) { return IteratorUtils.matchesAny(emptyIteratorIfNull(iterable), predicate); } @SuppressWarnings("unchecked") // OK, empty collection is compatible with any type static Iterable<E> emptyIterable(); @S...
@Test public void matchesAll() { try { assertFalse(IterableUtils.matchesAll(null, null)); fail("predicate must not be null"); } catch (NullPointerException ex) { } try { assertFalse(IterableUtils.matchesAll(iterableA, null)); fail("predicate must not be null"); } catch (NullPointerException ex) { } Predicate<Integer> l...
public static <E> boolean matchesAll(final Iterable<E> iterable, final Predicate<? super E> predicate) { return IteratorUtils.matchesAll(emptyIteratorIfNull(iterable), predicate); }
IterableUtils { public static <E> boolean matchesAll(final Iterable<E> iterable, final Predicate<? super E> predicate) { return IteratorUtils.matchesAll(emptyIteratorIfNull(iterable), predicate); } }
IterableUtils { public static <E> boolean matchesAll(final Iterable<E> iterable, final Predicate<? super E> predicate) { return IteratorUtils.matchesAll(emptyIteratorIfNull(iterable), predicate); } }
IterableUtils { public static <E> boolean matchesAll(final Iterable<E> iterable, final Predicate<? super E> predicate) { return IteratorUtils.matchesAll(emptyIteratorIfNull(iterable), predicate); } @SuppressWarnings("unchecked") // OK, empty collection is compatible with any type static Iterable<E> emptyIterable(); @S...
IterableUtils { public static <E> boolean matchesAll(final Iterable<E> iterable, final Predicate<? super E> predicate) { return IteratorUtils.matchesAll(emptyIteratorIfNull(iterable), predicate); } @SuppressWarnings("unchecked") // OK, empty collection is compatible with any type static Iterable<E> emptyIterable(); @S...
@Test(expected = IndexOutOfBoundsException.class) public void getFromIterable() throws Exception { final Bag<String> bag = new HashBag<String>(); bag.add("element", 1); assertEquals("element", IterableUtils.get(bag, 0)); IterableUtils.get(bag, 1); }
public static <T> T get(final Iterable<T> iterable, final int index) { CollectionUtils.checkIndexBounds(index); if (iterable instanceof List<?>) { return ((List<T>) iterable).get(index); } return IteratorUtils.get(emptyIteratorIfNull(iterable), index); }
IterableUtils { public static <T> T get(final Iterable<T> iterable, final int index) { CollectionUtils.checkIndexBounds(index); if (iterable instanceof List<?>) { return ((List<T>) iterable).get(index); } return IteratorUtils.get(emptyIteratorIfNull(iterable), index); } }
IterableUtils { public static <T> T get(final Iterable<T> iterable, final int index) { CollectionUtils.checkIndexBounds(index); if (iterable instanceof List<?>) { return ((List<T>) iterable).get(index); } return IteratorUtils.get(emptyIteratorIfNull(iterable), index); } }
IterableUtils { public static <T> T get(final Iterable<T> iterable, final int index) { CollectionUtils.checkIndexBounds(index); if (iterable instanceof List<?>) { return ((List<T>) iterable).get(index); } return IteratorUtils.get(emptyIteratorIfNull(iterable), index); } @SuppressWarnings("unchecked") // OK, empty coll...
IterableUtils { public static <T> T get(final Iterable<T> iterable, final int index) { CollectionUtils.checkIndexBounds(index); if (iterable instanceof List<?>) { return ((List<T>) iterable).get(index); } return IteratorUtils.get(emptyIteratorIfNull(iterable), index); } @SuppressWarnings("unchecked") // OK, empty coll...
@SuppressWarnings("unchecked") @Test public void partition() { List<Integer> input = new ArrayList<Integer>(); input.add(1); input.add(2); input.add(3); input.add(4); List<List<Integer>> partitions = IterableUtils.partition(input, EQUALS_TWO); assertEquals(2, partitions.size()); Collection<Integer> partition = partitio...
public static <O> List<List<O>> partition(final Iterable<? extends O> iterable, final Predicate<? super O> predicate) { if (predicate == null) { throw new NullPointerException("Predicate must not be null."); } @SuppressWarnings({ "unchecked", "rawtypes" }) final Factory<List<O>> factory = FactoryUtils.instantiateFactor...
IterableUtils { public static <O> List<List<O>> partition(final Iterable<? extends O> iterable, final Predicate<? super O> predicate) { if (predicate == null) { throw new NullPointerException("Predicate must not be null."); } @SuppressWarnings({ "unchecked", "rawtypes" }) final Factory<List<O>> factory = FactoryUtils.i...
IterableUtils { public static <O> List<List<O>> partition(final Iterable<? extends O> iterable, final Predicate<? super O> predicate) { if (predicate == null) { throw new NullPointerException("Predicate must not be null."); } @SuppressWarnings({ "unchecked", "rawtypes" }) final Factory<List<O>> factory = FactoryUtils.i...
IterableUtils { public static <O> List<List<O>> partition(final Iterable<? extends O> iterable, final Predicate<? super O> predicate) { if (predicate == null) { throw new NullPointerException("Predicate must not be null."); } @SuppressWarnings({ "unchecked", "rawtypes" }) final Factory<List<O>> factory = FactoryUtils.i...
IterableUtils { public static <O> List<List<O>> partition(final Iterable<? extends O> iterable, final Predicate<? super O> predicate) { if (predicate == null) { throw new NullPointerException("Predicate must not be null."); } @SuppressWarnings({ "unchecked", "rawtypes" }) final Factory<List<O>> factory = FactoryUtils.i...
@Test public void testToString() { String result = IterableUtils.toString(iterableA); assertEquals("[1, 2, 2, 3, 3, 3, 4, 4, 4, 4]", result); result = IterableUtils.toString(new ArrayList<Integer>()); assertEquals("[]", result); result = IterableUtils.toString(null); assertEquals("[]", result); result = IterableUtils.t...
public static <E> String toString(final Iterable<E> iterable) { return IteratorUtils.toString(emptyIteratorIfNull(iterable)); }
IterableUtils { public static <E> String toString(final Iterable<E> iterable) { return IteratorUtils.toString(emptyIteratorIfNull(iterable)); } }
IterableUtils { public static <E> String toString(final Iterable<E> iterable) { return IteratorUtils.toString(emptyIteratorIfNull(iterable)); } }
IterableUtils { public static <E> String toString(final Iterable<E> iterable) { return IteratorUtils.toString(emptyIteratorIfNull(iterable)); } @SuppressWarnings("unchecked") // OK, empty collection is compatible with any type static Iterable<E> emptyIterable(); @SuppressWarnings("unchecked") static Iterable<E> chaine...
IterableUtils { public static <E> String toString(final Iterable<E> iterable) { return IteratorUtils.toString(emptyIteratorIfNull(iterable)); } @SuppressWarnings("unchecked") // OK, empty collection is compatible with any type static Iterable<E> emptyIterable(); @SuppressWarnings("unchecked") static Iterable<E> chaine...
@Test public void testToStringDelimiter() { Transformer<Integer, String> transformer = new Transformer<Integer, String>() { @Override public String transform(Integer input) { return new Integer(input * 2).toString(); } }; String result = IterableUtils.toString(iterableA, transformer, "", "", ""); assertEquals("24466688...
public static <E> String toString(final Iterable<E> iterable) { return IteratorUtils.toString(emptyIteratorIfNull(iterable)); }
IterableUtils { public static <E> String toString(final Iterable<E> iterable) { return IteratorUtils.toString(emptyIteratorIfNull(iterable)); } }
IterableUtils { public static <E> String toString(final Iterable<E> iterable) { return IteratorUtils.toString(emptyIteratorIfNull(iterable)); } }
IterableUtils { public static <E> String toString(final Iterable<E> iterable) { return IteratorUtils.toString(emptyIteratorIfNull(iterable)); } @SuppressWarnings("unchecked") // OK, empty collection is compatible with any type static Iterable<E> emptyIterable(); @SuppressWarnings("unchecked") static Iterable<E> chaine...
IterableUtils { public static <E> String toString(final Iterable<E> iterable) { return IteratorUtils.toString(emptyIteratorIfNull(iterable)); } @SuppressWarnings("unchecked") // OK, empty collection is compatible with any type static Iterable<E> emptyIterable(); @SuppressWarnings("unchecked") static Iterable<E> chaine...
@Test public void testToStringWithNullArguments() { String result = IterableUtils.toString(null, new Transformer<Integer, String>() { @Override public String transform(Integer input) { fail("not supposed to reach here"); return ""; } }, "", "(", ")"); assertEquals("()", result); try { IterableUtils.toString(new ArrayLi...
public static <E> String toString(final Iterable<E> iterable) { return IteratorUtils.toString(emptyIteratorIfNull(iterable)); }
IterableUtils { public static <E> String toString(final Iterable<E> iterable) { return IteratorUtils.toString(emptyIteratorIfNull(iterable)); } }
IterableUtils { public static <E> String toString(final Iterable<E> iterable) { return IteratorUtils.toString(emptyIteratorIfNull(iterable)); } }
IterableUtils { public static <E> String toString(final Iterable<E> iterable) { return IteratorUtils.toString(emptyIteratorIfNull(iterable)); } @SuppressWarnings("unchecked") // OK, empty collection is compatible with any type static Iterable<E> emptyIterable(); @SuppressWarnings("unchecked") static Iterable<E> chaine...
IterableUtils { public static <E> String toString(final Iterable<E> iterable) { return IteratorUtils.toString(emptyIteratorIfNull(iterable)); } @SuppressWarnings("unchecked") // OK, empty collection is compatible with any type static Iterable<E> emptyIterable(); @SuppressWarnings("unchecked") static Iterable<E> chaine...
@Test public void testLength() { for (int i = 0; i < before.size(); ++i) { final SequencesComparator<Character> comparator = new SequencesComparator<Character>(sequence(before.get(i)), sequence(after.get(i))); Assert.assertEquals(length[i], comparator.getScript().getModifications()); } }
public EditScript<T> getScript() { final EditScript<T> script = new EditScript<T>(); buildScript(0, sequence1.size(), 0, sequence2.size(), script); return script; }
SequencesComparator { public EditScript<T> getScript() { final EditScript<T> script = new EditScript<T>(); buildScript(0, sequence1.size(), 0, sequence2.size(), script); return script; } }
SequencesComparator { public EditScript<T> getScript() { final EditScript<T> script = new EditScript<T>(); buildScript(0, sequence1.size(), 0, sequence2.size(), script); return script; } SequencesComparator(final List<T> sequence1, final List<T> sequence2); SequencesComparator(final List<T> sequence1, final List<T> se...
SequencesComparator { public EditScript<T> getScript() { final EditScript<T> script = new EditScript<T>(); buildScript(0, sequence1.size(), 0, sequence2.size(), script); return script; } SequencesComparator(final List<T> sequence1, final List<T> sequence2); SequencesComparator(final List<T> sequence1, final List<T> se...
SequencesComparator { public EditScript<T> getScript() { final EditScript<T> script = new EditScript<T>(); buildScript(0, sequence1.size(), 0, sequence2.size(), script); return script; } SequencesComparator(final List<T> sequence1, final List<T> sequence2); SequencesComparator(final List<T> sequence1, final List<T> se...
@Test public void testExecution() { final ExecutionVisitor<Character> ev = new ExecutionVisitor<Character>(); for (int i = 0; i < before.size(); ++i) { ev.setList(sequence(before.get(i))); new SequencesComparator<Character>(sequence(before.get(i)), sequence(after.get(i))).getScript().visit(ev); Assert.assertEquals(afte...
public EditScript<T> getScript() { final EditScript<T> script = new EditScript<T>(); buildScript(0, sequence1.size(), 0, sequence2.size(), script); return script; }
SequencesComparator { public EditScript<T> getScript() { final EditScript<T> script = new EditScript<T>(); buildScript(0, sequence1.size(), 0, sequence2.size(), script); return script; } }
SequencesComparator { public EditScript<T> getScript() { final EditScript<T> script = new EditScript<T>(); buildScript(0, sequence1.size(), 0, sequence2.size(), script); return script; } SequencesComparator(final List<T> sequence1, final List<T> sequence2); SequencesComparator(final List<T> sequence1, final List<T> se...
SequencesComparator { public EditScript<T> getScript() { final EditScript<T> script = new EditScript<T>(); buildScript(0, sequence1.size(), 0, sequence2.size(), script); return script; } SequencesComparator(final List<T> sequence1, final List<T> sequence2); SequencesComparator(final List<T> sequence1, final List<T> se...
SequencesComparator { public EditScript<T> getScript() { final EditScript<T> script = new EditScript<T>(); buildScript(0, sequence1.size(), 0, sequence2.size(), script); return script; } SequencesComparator(final List<T> sequence1, final List<T> sequence2); SequencesComparator(final List<T> sequence1, final List<T> se...
@Test public void testExecuteReturnVoid() throws Exception { TypeToken<List<User>> pt = new TypeToken<List<User>>() { }; TypeToken<Void> rt = TypeToken.of(void.class); String srcSql = "update user set name=:1.name where id=:1.id"; AbstractOperator operator = getOperator(pt, rt, srcSql); final int[] expectedInts = new i...
@Override public Object execute(Object[] values, InvocationStat stat) { Iterables iterables = getIterables(values); if (iterables.isEmpty()) { return transformer.transform(new int[]{}); } Map<DataSource, Group> gorupMap = new HashMap<DataSource, Group>(); int t = 0; for (Object obj : iterables) { InvocationContext cont...
BatchUpdateOperator extends AbstractOperator { @Override public Object execute(Object[] values, InvocationStat stat) { Iterables iterables = getIterables(values); if (iterables.isEmpty()) { return transformer.transform(new int[]{}); } Map<DataSource, Group> gorupMap = new HashMap<DataSource, Group>(); int t = 0; for (O...
BatchUpdateOperator extends AbstractOperator { @Override public Object execute(Object[] values, InvocationStat stat) { Iterables iterables = getIterables(values); if (iterables.isEmpty()) { return transformer.transform(new int[]{}); } Map<DataSource, Group> gorupMap = new HashMap<DataSource, Group>(); int t = 0; for (O...
BatchUpdateOperator extends AbstractOperator { @Override public Object execute(Object[] values, InvocationStat stat) { Iterables iterables = getIterables(values); if (iterables.isEmpty()) { return transformer.transform(new int[]{}); } Map<DataSource, Group> gorupMap = new HashMap<DataSource, Group>(); int t = 0; for (O...
BatchUpdateOperator extends AbstractOperator { @Override public Object execute(Object[] values, InvocationStat stat) { Iterables iterables = getIterables(values); if (iterables.isEmpty()) { return transformer.transform(new int[]{}); } Map<DataSource, Group> gorupMap = new HashMap<DataSource, Group>(); int t = 0; for (O...
@Test public void testMinimal() { final String[] shadokAlph = new String[] { new String("GA"), new String("BU"), new String("ZO"), new String("MEU") }; final List<String> sentenceBefore = new ArrayList<String>(); final List<String> sentenceAfter = new ArrayList<String>(); sentenceBefore.add(shadokAlph[0]); sentenceBefo...
public EditScript<T> getScript() { final EditScript<T> script = new EditScript<T>(); buildScript(0, sequence1.size(), 0, sequence2.size(), script); return script; }
SequencesComparator { public EditScript<T> getScript() { final EditScript<T> script = new EditScript<T>(); buildScript(0, sequence1.size(), 0, sequence2.size(), script); return script; } }
SequencesComparator { public EditScript<T> getScript() { final EditScript<T> script = new EditScript<T>(); buildScript(0, sequence1.size(), 0, sequence2.size(), script); return script; } SequencesComparator(final List<T> sequence1, final List<T> sequence2); SequencesComparator(final List<T> sequence1, final List<T> se...
SequencesComparator { public EditScript<T> getScript() { final EditScript<T> script = new EditScript<T>(); buildScript(0, sequence1.size(), 0, sequence2.size(), script); return script; } SequencesComparator(final List<T> sequence1, final List<T> sequence2); SequencesComparator(final List<T> sequence1, final List<T> se...
SequencesComparator { public EditScript<T> getScript() { final EditScript<T> script = new EditScript<T>(); buildScript(0, sequence1.size(), 0, sequence2.size(), script); return script; } SequencesComparator(final List<T> sequence1, final List<T> sequence2); SequencesComparator(final List<T> sequence1, final List<T> se...
@Test public void testShadok() { final int lgMax = 5; final String[] shadokAlph = new String[] { new String("GA"), new String("BU"), new String("ZO"), new String("MEU") }; List<List<String>> shadokSentences = new ArrayList<List<String>>(); for (int lg=0; lg<lgMax; ++lg) { final List<List<String>> newTab = new ArrayList...
public EditScript<T> getScript() { final EditScript<T> script = new EditScript<T>(); buildScript(0, sequence1.size(), 0, sequence2.size(), script); return script; }
SequencesComparator { public EditScript<T> getScript() { final EditScript<T> script = new EditScript<T>(); buildScript(0, sequence1.size(), 0, sequence2.size(), script); return script; } }
SequencesComparator { public EditScript<T> getScript() { final EditScript<T> script = new EditScript<T>(); buildScript(0, sequence1.size(), 0, sequence2.size(), script); return script; } SequencesComparator(final List<T> sequence1, final List<T> sequence2); SequencesComparator(final List<T> sequence1, final List<T> se...
SequencesComparator { public EditScript<T> getScript() { final EditScript<T> script = new EditScript<T>(); buildScript(0, sequence1.size(), 0, sequence2.size(), script); return script; } SequencesComparator(final List<T> sequence1, final List<T> sequence2); SequencesComparator(final List<T> sequence1, final List<T> se...
SequencesComparator { public EditScript<T> getScript() { final EditScript<T> script = new EditScript<T>(); buildScript(0, sequence1.size(), 0, sequence2.size(), script); return script; } SequencesComparator(final List<T> sequence1, final List<T> sequence2); SequencesComparator(final List<T> sequence1, final List<T> se...
@Test public void testUnmodifiableTrie() { Trie<String, Object> trie = TrieUtils.unmodifiableTrie(new PatriciaTrie<Object>()); assertTrue("Returned object should be an UnmodifiableTrie.", trie instanceof UnmodifiableTrie); try { TrieUtils.unmodifiableTrie(null); fail("Expecting NullPointerException for null trie."); } ...
public static <K, V> Trie<K, V> unmodifiableTrie(final Trie<K, ? extends V> trie) { return UnmodifiableTrie.unmodifiableTrie(trie); }
TrieUtils { public static <K, V> Trie<K, V> unmodifiableTrie(final Trie<K, ? extends V> trie) { return UnmodifiableTrie.unmodifiableTrie(trie); } }
TrieUtils { public static <K, V> Trie<K, V> unmodifiableTrie(final Trie<K, ? extends V> trie) { return UnmodifiableTrie.unmodifiableTrie(trie); } private TrieUtils(); }
TrieUtils { public static <K, V> Trie<K, V> unmodifiableTrie(final Trie<K, ? extends V> trie) { return UnmodifiableTrie.unmodifiableTrie(trie); } private TrieUtils(); static Trie<K, V> unmodifiableTrie(final Trie<K, ? extends V> trie); }
TrieUtils { public static <K, V> Trie<K, V> unmodifiableTrie(final Trie<K, ? extends V> trie) { return UnmodifiableTrie.unmodifiableTrie(trie); } private TrieUtils(); static Trie<K, V> unmodifiableTrie(final Trie<K, ? extends V> trie); }
@Test public void testUnmodifiableQueue() { Queue<Object> queue = QueueUtils.unmodifiableQueue(new LinkedList<Object>()); assertTrue("Returned object should be an UnmodifiableQueue.", queue instanceof UnmodifiableQueue); try { QueueUtils.unmodifiableQueue(null); fail("Expecting NullPointerException for null queue."); }...
public static <E> Queue<E> unmodifiableQueue(final Queue<? extends E> queue) { return UnmodifiableQueue.unmodifiableQueue(queue); }
QueueUtils { public static <E> Queue<E> unmodifiableQueue(final Queue<? extends E> queue) { return UnmodifiableQueue.unmodifiableQueue(queue); } }
QueueUtils { public static <E> Queue<E> unmodifiableQueue(final Queue<? extends E> queue) { return UnmodifiableQueue.unmodifiableQueue(queue); } private QueueUtils(); }
QueueUtils { public static <E> Queue<E> unmodifiableQueue(final Queue<? extends E> queue) { return UnmodifiableQueue.unmodifiableQueue(queue); } private QueueUtils(); static Queue<E> unmodifiableQueue(final Queue<? extends E> queue); static Queue<E> predicatedQueue(final Queue<E> queue, final Predicate<? super E> pred...
QueueUtils { public static <E> Queue<E> unmodifiableQueue(final Queue<? extends E> queue) { return UnmodifiableQueue.unmodifiableQueue(queue); } private QueueUtils(); static Queue<E> unmodifiableQueue(final Queue<? extends E> queue); static Queue<E> predicatedQueue(final Queue<E> queue, final Predicate<? super E> pred...
@Test public void testPredicatedQueue() { Queue<Object> queue = QueueUtils.predicatedQueue(new LinkedList<Object>(), truePredicate); assertTrue("Returned object should be a PredicatedQueue.", queue instanceof PredicatedQueue); try { QueueUtils.predicatedQueue(null, truePredicate); fail("Expecting NullPointerException f...
public static <E> Queue<E> predicatedQueue(final Queue<E> queue, final Predicate<? super E> predicate) { return PredicatedQueue.predicatedQueue(queue, predicate); }
QueueUtils { public static <E> Queue<E> predicatedQueue(final Queue<E> queue, final Predicate<? super E> predicate) { return PredicatedQueue.predicatedQueue(queue, predicate); } }
QueueUtils { public static <E> Queue<E> predicatedQueue(final Queue<E> queue, final Predicate<? super E> predicate) { return PredicatedQueue.predicatedQueue(queue, predicate); } private QueueUtils(); }
QueueUtils { public static <E> Queue<E> predicatedQueue(final Queue<E> queue, final Predicate<? super E> predicate) { return PredicatedQueue.predicatedQueue(queue, predicate); } private QueueUtils(); static Queue<E> unmodifiableQueue(final Queue<? extends E> queue); static Queue<E> predicatedQueue(final Queue<E> queue...
QueueUtils { public static <E> Queue<E> predicatedQueue(final Queue<E> queue, final Predicate<? super E> predicate) { return PredicatedQueue.predicatedQueue(queue, predicate); } private QueueUtils(); static Queue<E> unmodifiableQueue(final Queue<? extends E> queue); static Queue<E> predicatedQueue(final Queue<E> queue...
@Test public void testTransformedQueue() { Queue<Object> queue = QueueUtils.transformingQueue(new LinkedList<Object>(), nopTransformer); assertTrue("Returned object should be an TransformedQueue.", queue instanceof TransformedQueue); try { QueueUtils.transformingQueue(null, nopTransformer); fail("Expecting NullPointerE...
public static <E> Queue<E> transformingQueue(final Queue<E> queue, final Transformer<? super E, ? extends E> transformer) { return TransformedQueue.transformingQueue(queue, transformer); }
QueueUtils { public static <E> Queue<E> transformingQueue(final Queue<E> queue, final Transformer<? super E, ? extends E> transformer) { return TransformedQueue.transformingQueue(queue, transformer); } }
QueueUtils { public static <E> Queue<E> transformingQueue(final Queue<E> queue, final Transformer<? super E, ? extends E> transformer) { return TransformedQueue.transformingQueue(queue, transformer); } private QueueUtils(); }
QueueUtils { public static <E> Queue<E> transformingQueue(final Queue<E> queue, final Transformer<? super E, ? extends E> transformer) { return TransformedQueue.transformingQueue(queue, transformer); } private QueueUtils(); static Queue<E> unmodifiableQueue(final Queue<? extends E> queue); static Queue<E> predicatedQu...
QueueUtils { public static <E> Queue<E> transformingQueue(final Queue<E> queue, final Transformer<? super E, ? extends E> transformer) { return TransformedQueue.transformingQueue(queue, transformer); } private QueueUtils(); static Queue<E> unmodifiableQueue(final Queue<? extends E> queue); static Queue<E> predicatedQu...
@Test public void testEmptyQueue() { Queue<Object> queue = QueueUtils.emptyQueue(); assertTrue("Returned object should be an UnmodifiableQueue.", queue instanceof UnmodifiableQueue); assertTrue("Returned queue is not empty.", queue.isEmpty()); try { queue.add(new Object()); fail("Expecting UnsupportedOperationException...
@SuppressWarnings("unchecked") public static <E> Queue<E> emptyQueue() { return (Queue<E>) EMPTY_QUEUE; }
QueueUtils { @SuppressWarnings("unchecked") public static <E> Queue<E> emptyQueue() { return (Queue<E>) EMPTY_QUEUE; } }
QueueUtils { @SuppressWarnings("unchecked") public static <E> Queue<E> emptyQueue() { return (Queue<E>) EMPTY_QUEUE; } private QueueUtils(); }
QueueUtils { @SuppressWarnings("unchecked") public static <E> Queue<E> emptyQueue() { return (Queue<E>) EMPTY_QUEUE; } private QueueUtils(); static Queue<E> unmodifiableQueue(final Queue<? extends E> queue); static Queue<E> predicatedQueue(final Queue<E> queue, final Predicate<? super E> predicate); static Queue<E> tr...
QueueUtils { @SuppressWarnings("unchecked") public static <E> Queue<E> emptyQueue() { return (Queue<E>) EMPTY_QUEUE; } private QueueUtils(); static Queue<E> unmodifiableQueue(final Queue<? extends E> queue); static Queue<E> predicatedQueue(final Queue<E> queue, final Predicate<? super E> predicate); static Queue<E> tr...
@Test public void testToListWithStringTokenizer() { final List<String> expectedList1 = new ArrayList<String>(); final StringTokenizer st = new StringTokenizer(TO_LIST_FIXTURE); while (st.hasMoreTokens()) { expectedList1.add(st.nextToken()); } final List<String> expectedList2 = new ArrayList<String>(); expectedList2.add...
public static <E> List<E> toList(final Enumeration<? extends E> enumeration) { return IteratorUtils.toList(new EnumerationIterator<E>(enumeration)); }
EnumerationUtils { public static <E> List<E> toList(final Enumeration<? extends E> enumeration) { return IteratorUtils.toList(new EnumerationIterator<E>(enumeration)); } }
EnumerationUtils { public static <E> List<E> toList(final Enumeration<? extends E> enumeration) { return IteratorUtils.toList(new EnumerationIterator<E>(enumeration)); } private EnumerationUtils(); }
EnumerationUtils { public static <E> List<E> toList(final Enumeration<? extends E> enumeration) { return IteratorUtils.toList(new EnumerationIterator<E>(enumeration)); } private EnumerationUtils(); static T get(final Enumeration<T> e, final int index); static List<E> toList(final Enumeration<? extends E> enumeration);...
EnumerationUtils { public static <E> List<E> toList(final Enumeration<? extends E> enumeration) { return IteratorUtils.toList(new EnumerationIterator<E>(enumeration)); } private EnumerationUtils(); static T get(final Enumeration<T> e, final int index); static List<E> toList(final Enumeration<? extends E> enumeration);...
@Test public void testToListWithHashtable() { final Hashtable<String, Integer> expected = new Hashtable<String, Integer>(); expected.put("one", Integer.valueOf(1)); expected.put("two", Integer.valueOf(2)); expected.put("three", Integer.valueOf(3)); final List<Integer> actualEltList = EnumerationUtils.toList(expected.el...
public static <E> List<E> toList(final Enumeration<? extends E> enumeration) { return IteratorUtils.toList(new EnumerationIterator<E>(enumeration)); }
EnumerationUtils { public static <E> List<E> toList(final Enumeration<? extends E> enumeration) { return IteratorUtils.toList(new EnumerationIterator<E>(enumeration)); } }
EnumerationUtils { public static <E> List<E> toList(final Enumeration<? extends E> enumeration) { return IteratorUtils.toList(new EnumerationIterator<E>(enumeration)); } private EnumerationUtils(); }
EnumerationUtils { public static <E> List<E> toList(final Enumeration<? extends E> enumeration) { return IteratorUtils.toList(new EnumerationIterator<E>(enumeration)); } private EnumerationUtils(); static T get(final Enumeration<T> e, final int index); static List<E> toList(final Enumeration<? extends E> enumeration);...
EnumerationUtils { public static <E> List<E> toList(final Enumeration<? extends E> enumeration) { return IteratorUtils.toList(new EnumerationIterator<E>(enumeration)); } private EnumerationUtils(); static T get(final Enumeration<T> e, final int index); static List<E> toList(final Enumeration<? extends E> enumeration);...
@Test public void getFromEnumeration() throws Exception { final Vector<String> vector = new Vector<String>(); vector.addElement("zero"); vector.addElement("one"); Enumeration<String> en = vector.elements(); assertEquals("zero", EnumerationUtils.get(en, 0)); en = vector.elements(); assertEquals("one", EnumerationUtils.g...
public static <T> T get(final Enumeration<T> e, final int index) { int i = index; CollectionUtils.checkIndexBounds(i); while (e.hasMoreElements()) { i--; if (i == -1) { return e.nextElement(); } else { e.nextElement(); } } throw new IndexOutOfBoundsException("Entry does not exist: " + i); }
EnumerationUtils { public static <T> T get(final Enumeration<T> e, final int index) { int i = index; CollectionUtils.checkIndexBounds(i); while (e.hasMoreElements()) { i--; if (i == -1) { return e.nextElement(); } else { e.nextElement(); } } throw new IndexOutOfBoundsException("Entry does not exist: " + i); } }
EnumerationUtils { public static <T> T get(final Enumeration<T> e, final int index) { int i = index; CollectionUtils.checkIndexBounds(i); while (e.hasMoreElements()) { i--; if (i == -1) { return e.nextElement(); } else { e.nextElement(); } } throw new IndexOutOfBoundsException("Entry does not exist: " + i); } private ...
EnumerationUtils { public static <T> T get(final Enumeration<T> e, final int index) { int i = index; CollectionUtils.checkIndexBounds(i); while (e.hasMoreElements()) { i--; if (i == -1) { return e.nextElement(); } else { e.nextElement(); } } throw new IndexOutOfBoundsException("Entry does not exist: " + i); } private ...
EnumerationUtils { public static <T> T get(final Enumeration<T> e, final int index) { int i = index; CollectionUtils.checkIndexBounds(i); while (e.hasMoreElements()) { i--; if (i == -1) { return e.nextElement(); } else { e.nextElement(); } } throw new IndexOutOfBoundsException("Entry does not exist: " + i); } private ...
@Test public void testExecuteReturnInt() throws Exception { TypeToken<List<User>> pt = new TypeToken<List<User>>() { }; TypeToken<Integer> rt = TypeToken.of(int.class); String srcSql = "update user set name=:1.name where id=:1.id"; AbstractOperator operator = getOperator(pt, rt, srcSql); final int[] expectedInts = new ...
@Override public Object execute(Object[] values, InvocationStat stat) { Iterables iterables = getIterables(values); if (iterables.isEmpty()) { return transformer.transform(new int[]{}); } Map<DataSource, Group> gorupMap = new HashMap<DataSource, Group>(); int t = 0; for (Object obj : iterables) { InvocationContext cont...
BatchUpdateOperator extends AbstractOperator { @Override public Object execute(Object[] values, InvocationStat stat) { Iterables iterables = getIterables(values); if (iterables.isEmpty()) { return transformer.transform(new int[]{}); } Map<DataSource, Group> gorupMap = new HashMap<DataSource, Group>(); int t = 0; for (O...
BatchUpdateOperator extends AbstractOperator { @Override public Object execute(Object[] values, InvocationStat stat) { Iterables iterables = getIterables(values); if (iterables.isEmpty()) { return transformer.transform(new int[]{}); } Map<DataSource, Group> gorupMap = new HashMap<DataSource, Group>(); int t = 0; for (O...
BatchUpdateOperator extends AbstractOperator { @Override public Object execute(Object[] values, InvocationStat stat) { Iterables iterables = getIterables(values); if (iterables.isEmpty()) { return transformer.transform(new int[]{}); } Map<DataSource, Group> gorupMap = new HashMap<DataSource, Group>(); int t = 0; for (O...
BatchUpdateOperator extends AbstractOperator { @Override public Object execute(Object[] values, InvocationStat stat) { Iterables iterables = getIterables(values); if (iterables.isEmpty()) { return transformer.transform(new int[]{}); } Map<DataSource, Group> gorupMap = new HashMap<DataSource, Group>(); int t = 0; for (O...
@Test public void testRemoveWithoutCallingNext() { List<E> testListCopy = new ArrayList<E>(testList); Iterator<E> iter = new BoundedIterator<E>(testListCopy.iterator(), 1, 5); try { iter.remove(); fail("Expected IllegalStateException."); } catch (IllegalStateException ise) { } }
public void remove() { if (pos <= offset) { throw new IllegalStateException("remove() can not be called before calling next()"); } iterator.remove(); }
BoundedIterator implements Iterator<E> { public void remove() { if (pos <= offset) { throw new IllegalStateException("remove() can not be called before calling next()"); } iterator.remove(); } }
BoundedIterator implements Iterator<E> { public void remove() { if (pos <= offset) { throw new IllegalStateException("remove() can not be called before calling next()"); } iterator.remove(); } BoundedIterator(final Iterator<? extends E> iterator, final long offset, final long max); }
BoundedIterator implements Iterator<E> { public void remove() { if (pos <= offset) { throw new IllegalStateException("remove() can not be called before calling next()"); } iterator.remove(); } BoundedIterator(final Iterator<? extends E> iterator, final long offset, final long max); boolean hasNext(); E next(); void rem...
BoundedIterator implements Iterator<E> { public void remove() { if (pos <= offset) { throw new IllegalStateException("remove() can not be called before calling next()"); } iterator.remove(); } BoundedIterator(final Iterator<? extends E> iterator, final long offset, final long max); boolean hasNext(); E next(); void rem...
@Test public void testSkipping() { Iterator<E> iter = new SkippingIterator<E>(testList.iterator(), 2); assertTrue(iter.hasNext()); assertEquals("c", iter.next()); assertTrue(iter.hasNext()); assertEquals("d", iter.next()); assertTrue(iter.hasNext()); assertEquals("e", iter.next()); assertTrue(iter.hasNext()); assertEqu...
@Override public E next() { final E next = super.next(); pos++; return next; }
SkippingIterator extends AbstractIteratorDecorator<E> { @Override public E next() { final E next = super.next(); pos++; return next; } }
SkippingIterator extends AbstractIteratorDecorator<E> { @Override public E next() { final E next = super.next(); pos++; return next; } SkippingIterator(final Iterator<E> iterator, final long offset); }
SkippingIterator extends AbstractIteratorDecorator<E> { @Override public E next() { final E next = super.next(); pos++; return next; } SkippingIterator(final Iterator<E> iterator, final long offset); @Override E next(); @Override void remove(); }
SkippingIterator extends AbstractIteratorDecorator<E> { @Override public E next() { final E next = super.next(); pos++; return next; } SkippingIterator(final Iterator<E> iterator, final long offset); @Override E next(); @Override void remove(); }
@Test public void testSameAsDecorated() { Iterator<E> iter = new SkippingIterator<E>(testList.iterator(), 0); assertTrue(iter.hasNext()); assertEquals("a", iter.next()); assertTrue(iter.hasNext()); assertEquals("b", iter.next()); assertTrue(iter.hasNext()); assertEquals("c", iter.next()); assertTrue(iter.hasNext()); as...
@Override public E next() { final E next = super.next(); pos++; return next; }
SkippingIterator extends AbstractIteratorDecorator<E> { @Override public E next() { final E next = super.next(); pos++; return next; } }
SkippingIterator extends AbstractIteratorDecorator<E> { @Override public E next() { final E next = super.next(); pos++; return next; } SkippingIterator(final Iterator<E> iterator, final long offset); }
SkippingIterator extends AbstractIteratorDecorator<E> { @Override public E next() { final E next = super.next(); pos++; return next; } SkippingIterator(final Iterator<E> iterator, final long offset); @Override E next(); @Override void remove(); }
SkippingIterator extends AbstractIteratorDecorator<E> { @Override public E next() { final E next = super.next(); pos++; return next; } SkippingIterator(final Iterator<E> iterator, final long offset); @Override E next(); @Override void remove(); }
@Test public void testOffsetGreaterThanSize() { Iterator<E> iter = new SkippingIterator<E>(testList.iterator(), 10); assertFalse(iter.hasNext()); try { iter.next(); fail("Expected NoSuchElementException."); } catch (NoSuchElementException nsee) { } }
@Override public E next() { final E next = super.next(); pos++; return next; }
SkippingIterator extends AbstractIteratorDecorator<E> { @Override public E next() { final E next = super.next(); pos++; return next; } }
SkippingIterator extends AbstractIteratorDecorator<E> { @Override public E next() { final E next = super.next(); pos++; return next; } SkippingIterator(final Iterator<E> iterator, final long offset); }
SkippingIterator extends AbstractIteratorDecorator<E> { @Override public E next() { final E next = super.next(); pos++; return next; } SkippingIterator(final Iterator<E> iterator, final long offset); @Override E next(); @Override void remove(); }
SkippingIterator extends AbstractIteratorDecorator<E> { @Override public E next() { final E next = super.next(); pos++; return next; } SkippingIterator(final Iterator<E> iterator, final long offset); @Override E next(); @Override void remove(); }
@Test public void testRemoveWithoutCallingNext() { List<E> testListCopy = new ArrayList<E>(testList); Iterator<E> iter = new SkippingIterator<E>(testListCopy.iterator(), 1); try { iter.remove(); fail("Expected IllegalStateException."); } catch (IllegalStateException ise) { } }
@Override public void remove() { if (pos <= offset) { throw new IllegalStateException("remove() can not be called before calling next()"); } super.remove(); }
SkippingIterator extends AbstractIteratorDecorator<E> { @Override public void remove() { if (pos <= offset) { throw new IllegalStateException("remove() can not be called before calling next()"); } super.remove(); } }
SkippingIterator extends AbstractIteratorDecorator<E> { @Override public void remove() { if (pos <= offset) { throw new IllegalStateException("remove() can not be called before calling next()"); } super.remove(); } SkippingIterator(final Iterator<E> iterator, final long offset); }
SkippingIterator extends AbstractIteratorDecorator<E> { @Override public void remove() { if (pos <= offset) { throw new IllegalStateException("remove() can not be called before calling next()"); } super.remove(); } SkippingIterator(final Iterator<E> iterator, final long offset); @Override E next(); @Override void remov...
SkippingIterator extends AbstractIteratorDecorator<E> { @Override public void remove() { if (pos <= offset) { throw new IllegalStateException("remove() can not be called before calling next()"); } super.remove(); } SkippingIterator(final Iterator<E> iterator, final long offset); @Override E next(); @Override void remov...
@Test public void testEmpty() { Iterator<E> it = makeEmptyIterator(); assertFalse(it.hasNext()); }
public boolean hasNext() { if (exhausted) { return false; } return slotFilled ? true : iterator.hasNext(); }
PeekingIterator implements Iterator<E> { public boolean hasNext() { if (exhausted) { return false; } return slotFilled ? true : iterator.hasNext(); } }
PeekingIterator implements Iterator<E> { public boolean hasNext() { if (exhausted) { return false; } return slotFilled ? true : iterator.hasNext(); } PeekingIterator(final Iterator<? extends E> iterator); }
PeekingIterator implements Iterator<E> { public boolean hasNext() { if (exhausted) { return false; } return slotFilled ? true : iterator.hasNext(); } PeekingIterator(final Iterator<? extends E> iterator); static PeekingIterator<E> peekingIterator(final Iterator<? extends E> iterator); boolean hasNext(); E peek(); E ele...
PeekingIterator implements Iterator<E> { public boolean hasNext() { if (exhausted) { return false; } return slotFilled ? true : iterator.hasNext(); } PeekingIterator(final Iterator<? extends E> iterator); static PeekingIterator<E> peekingIterator(final Iterator<? extends E> iterator); boolean hasNext(); E peek(); E ele...
@Test public void testPredicatedMap() { final Predicate<Object> p = getPredicate(); Map<Object, Object> map = MapUtils.predicatedMap(new HashMap<Object, Object>(), p, p); assertTrue("returned object should be a PredicatedMap", map instanceof PredicatedMap); try { MapUtils.predicatedMap(null, p, p); fail("Expecting Null...
public static <K, V> IterableMap<K, V> predicatedMap(final Map<K, V> map, final Predicate<? super K> keyPred, final Predicate<? super V> valuePred) { return PredicatedMap.predicatedMap(map, keyPred, valuePred); }
MapUtils { public static <K, V> IterableMap<K, V> predicatedMap(final Map<K, V> map, final Predicate<? super K> keyPred, final Predicate<? super V> valuePred) { return PredicatedMap.predicatedMap(map, keyPred, valuePred); } }
MapUtils { public static <K, V> IterableMap<K, V> predicatedMap(final Map<K, V> map, final Predicate<? super K> keyPred, final Predicate<? super V> valuePred) { return PredicatedMap.predicatedMap(map, keyPred, valuePred); } private MapUtils(); }
MapUtils { public static <K, V> IterableMap<K, V> predicatedMap(final Map<K, V> map, final Predicate<? super K> keyPred, final Predicate<? super V> valuePred) { return PredicatedMap.predicatedMap(map, keyPred, valuePred); } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); static String...
MapUtils { public static <K, V> IterableMap<K, V> predicatedMap(final Map<K, V> map, final Predicate<? super K> keyPred, final Predicate<? super V> valuePred) { return PredicatedMap.predicatedMap(map, keyPred, valuePred); } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); static String...
@Test public void testLazyMapFactory() { final Factory<Integer> factory = FactoryUtils.constantFactory(Integer.valueOf(5)); Map<Object, Object> map = MapUtils.lazyMap(new HashMap<Object, Object>(), factory); assertTrue(map instanceof LazyMap); try { map = MapUtils.lazyMap(new HashMap<Object, Object>(), (Factory<Object>...
public static <K, V> IterableMap<K, V> lazyMap(final Map<K, V> map, final Factory<? extends V> factory) { return LazyMap.lazyMap(map, factory); }
MapUtils { public static <K, V> IterableMap<K, V> lazyMap(final Map<K, V> map, final Factory<? extends V> factory) { return LazyMap.lazyMap(map, factory); } }
MapUtils { public static <K, V> IterableMap<K, V> lazyMap(final Map<K, V> map, final Factory<? extends V> factory) { return LazyMap.lazyMap(map, factory); } private MapUtils(); }
MapUtils { public static <K, V> IterableMap<K, V> lazyMap(final Map<K, V> map, final Factory<? extends V> factory) { return LazyMap.lazyMap(map, factory); } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); static String getString(final Map<? super K, ?> map, final K key); static Boolea...
MapUtils { public static <K, V> IterableMap<K, V> lazyMap(final Map<K, V> map, final Factory<? extends V> factory) { return LazyMap.lazyMap(map, factory); } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); static String getString(final Map<? super K, ?> map, final K key); static Boolea...
@Test public void testLazyMapTransformer() { final Map<Object, Object> map = MapUtils.lazyMap(new HashMap<Object, Object>(), new Transformer<Object, Object>() { public Object transform(final Object mapKey) { if (mapKey instanceof String) { return Integer.valueOf((String) mapKey); } return null; } }); assertEquals(0, ma...
public static <K, V> IterableMap<K, V> lazyMap(final Map<K, V> map, final Factory<? extends V> factory) { return LazyMap.lazyMap(map, factory); }
MapUtils { public static <K, V> IterableMap<K, V> lazyMap(final Map<K, V> map, final Factory<? extends V> factory) { return LazyMap.lazyMap(map, factory); } }
MapUtils { public static <K, V> IterableMap<K, V> lazyMap(final Map<K, V> map, final Factory<? extends V> factory) { return LazyMap.lazyMap(map, factory); } private MapUtils(); }
MapUtils { public static <K, V> IterableMap<K, V> lazyMap(final Map<K, V> map, final Factory<? extends V> factory) { return LazyMap.lazyMap(map, factory); } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); static String getString(final Map<? super K, ?> map, final K key); static Boolea...
MapUtils { public static <K, V> IterableMap<K, V> lazyMap(final Map<K, V> map, final Factory<? extends V> factory) { return LazyMap.lazyMap(map, factory); } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); static String getString(final Map<? super K, ?> map, final K key); static Boolea...
@Test public void testInvertMap() { final Map<String, String> in = new HashMap<String, String>(5, 1); in.put("1", "A"); in.put("2", "B"); in.put("3", "C"); in.put("4", "D"); in.put("5", "E"); final Set<String> inKeySet = new HashSet<String>(in.keySet()); final Set<String> inValSet = new HashSet<String>(in.values()); fi...
public static <K, V> Map<V, K> invertMap(final Map<K, V> map) { final Map<V, K> out = new HashMap<V, K>(map.size()); for (final Entry<K, V> entry : map.entrySet()) { out.put(entry.getValue(), entry.getKey()); } return out; }
MapUtils { public static <K, V> Map<V, K> invertMap(final Map<K, V> map) { final Map<V, K> out = new HashMap<V, K>(map.size()); for (final Entry<K, V> entry : map.entrySet()) { out.put(entry.getValue(), entry.getKey()); } return out; } }
MapUtils { public static <K, V> Map<V, K> invertMap(final Map<K, V> map) { final Map<V, K> out = new HashMap<V, K>(map.size()); for (final Entry<K, V> entry : map.entrySet()) { out.put(entry.getValue(), entry.getKey()); } return out; } private MapUtils(); }
MapUtils { public static <K, V> Map<V, K> invertMap(final Map<K, V> map) { final Map<V, K> out = new HashMap<V, K>(map.size()); for (final Entry<K, V> entry : map.entrySet()) { out.put(entry.getValue(), entry.getKey()); } return out; } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); s...
MapUtils { public static <K, V> Map<V, K> invertMap(final Map<K, V> map) { final Map<V, K> out = new HashMap<V, K>(map.size()); for (final Entry<K, V> entry : map.entrySet()) { out.put(entry.getValue(), entry.getKey()); } return out; } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); s...
@Test public void testExecuteReturnIntArray() throws Exception { TypeToken<List<User>> pt = new TypeToken<List<User>>() { }; TypeToken<int[]> rt = TypeToken.of(int[].class); String srcSql = "update user set name=:1.name where id=:1.id"; AbstractOperator operator = getOperator(pt, rt, srcSql); final int[] expectedInts =...
@Override public Object execute(Object[] values, InvocationStat stat) { Iterables iterables = getIterables(values); if (iterables.isEmpty()) { return transformer.transform(new int[]{}); } Map<DataSource, Group> gorupMap = new HashMap<DataSource, Group>(); int t = 0; for (Object obj : iterables) { InvocationContext cont...
BatchUpdateOperator extends AbstractOperator { @Override public Object execute(Object[] values, InvocationStat stat) { Iterables iterables = getIterables(values); if (iterables.isEmpty()) { return transformer.transform(new int[]{}); } Map<DataSource, Group> gorupMap = new HashMap<DataSource, Group>(); int t = 0; for (O...
BatchUpdateOperator extends AbstractOperator { @Override public Object execute(Object[] values, InvocationStat stat) { Iterables iterables = getIterables(values); if (iterables.isEmpty()) { return transformer.transform(new int[]{}); } Map<DataSource, Group> gorupMap = new HashMap<DataSource, Group>(); int t = 0; for (O...
BatchUpdateOperator extends AbstractOperator { @Override public Object execute(Object[] values, InvocationStat stat) { Iterables iterables = getIterables(values); if (iterables.isEmpty()) { return transformer.transform(new int[]{}); } Map<DataSource, Group> gorupMap = new HashMap<DataSource, Group>(); int t = 0; for (O...
BatchUpdateOperator extends AbstractOperator { @Override public Object execute(Object[] values, InvocationStat stat) { Iterables iterables = getIterables(values); if (iterables.isEmpty()) { return transformer.transform(new int[]{}); } Map<DataSource, Group> gorupMap = new HashMap<DataSource, Group>(); int t = 0; for (O...
@Test public void testPutAll_Map_array() { try { MapUtils.putAll(null, null); fail(); } catch (final NullPointerException ex) {} try { MapUtils.putAll(null, new Object[0]); fail(); } catch (final NullPointerException ex) {} Map<String, String> test = MapUtils.putAll(new HashMap<String, String>(), new String[0]); assert...
@SuppressWarnings("unchecked") public static <K, V> Map<K, V> putAll(final Map<K, V> map, final Object[] array) { if (map == null) { throw new NullPointerException("The map must not be null"); } if (array == null || array.length == 0) { return map; } final Object obj = array[0]; if (obj instanceof Map.Entry) { for (fin...
MapUtils { @SuppressWarnings("unchecked") public static <K, V> Map<K, V> putAll(final Map<K, V> map, final Object[] array) { if (map == null) { throw new NullPointerException("The map must not be null"); } if (array == null || array.length == 0) { return map; } final Object obj = array[0]; if (obj instanceof Map.Entry)...
MapUtils { @SuppressWarnings("unchecked") public static <K, V> Map<K, V> putAll(final Map<K, V> map, final Object[] array) { if (map == null) { throw new NullPointerException("The map must not be null"); } if (array == null || array.length == 0) { return map; } final Object obj = array[0]; if (obj instanceof Map.Entry)...
MapUtils { @SuppressWarnings("unchecked") public static <K, V> Map<K, V> putAll(final Map<K, V> map, final Object[] array) { if (map == null) { throw new NullPointerException("The map must not be null"); } if (array == null || array.length == 0) { return map; } final Object obj = array[0]; if (obj instanceof Map.Entry)...
MapUtils { @SuppressWarnings("unchecked") public static <K, V> Map<K, V> putAll(final Map<K, V> map, final Object[] array) { if (map == null) { throw new NullPointerException("The map must not be null"); } if (array == null || array.length == 0) { return map; } final Object obj = array[0]; if (obj instanceof Map.Entry)...
@Test public void testConvertResourceBundle() { final Map<String, String> in = new HashMap<String, String>( 5 , 1 ); in.put("1", "A"); in.put("2", "B"); in.put("3", "C"); in.put("4", "D"); in.put("5", "E"); final ResourceBundle b = new ListResourceBundle() { @Override public Object[][] getContents() { final Object[][] ...
public static Map<String, Object> toMap(final ResourceBundle resourceBundle) { final Enumeration<String> enumeration = resourceBundle.getKeys(); final Map<String, Object> map = new HashMap<String, Object>(); while (enumeration.hasMoreElements()) { final String key = enumeration.nextElement(); final Object value = resou...
MapUtils { public static Map<String, Object> toMap(final ResourceBundle resourceBundle) { final Enumeration<String> enumeration = resourceBundle.getKeys(); final Map<String, Object> map = new HashMap<String, Object>(); while (enumeration.hasMoreElements()) { final String key = enumeration.nextElement(); final Object va...
MapUtils { public static Map<String, Object> toMap(final ResourceBundle resourceBundle) { final Enumeration<String> enumeration = resourceBundle.getKeys(); final Map<String, Object> map = new HashMap<String, Object>(); while (enumeration.hasMoreElements()) { final String key = enumeration.nextElement(); final Object va...
MapUtils { public static Map<String, Object> toMap(final ResourceBundle resourceBundle) { final Enumeration<String> enumeration = resourceBundle.getKeys(); final Map<String, Object> map = new HashMap<String, Object>(); while (enumeration.hasMoreElements()) { final String key = enumeration.nextElement(); final Object va...
MapUtils { public static Map<String, Object> toMap(final ResourceBundle resourceBundle) { final Enumeration<String> enumeration = resourceBundle.getKeys(); final Map<String, Object> map = new HashMap<String, Object>(); while (enumeration.hasMoreElements()) { final String key = enumeration.nextElement(); final Object va...
@Test public void testDebugAndVerbosePrintCasting() { final Map<Integer, String> inner = new HashMap<Integer, String>(2, 1); inner.put(2, "B"); inner.put(3, "C"); final Map<Integer, Object> outer = new HashMap<Integer, Object>(2, 1); outer.put(0, inner); outer.put(1, "A"); final ByteArrayOutputStream out = new ByteArra...
public static void debugPrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), true); }
MapUtils { public static void debugPrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), true); } }
MapUtils { public static void debugPrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), true); } private MapUtils(); }
MapUtils { public static void debugPrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), true); } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); static String getString(final Map<? super K, ?> map, f...
MapUtils { public static void debugPrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), true); } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); static String getString(final Map<? super K, ?> map, f...
@Test public void testVerbosePrintNullLabel() { final ByteArrayOutputStream out = new ByteArrayOutputStream(); final PrintStream outPrint = new PrintStream(out); final String INDENT = " "; final Map<Integer, String> map = new TreeMap<Integer, String>(); map.put(2, "B"); map.put(3, "C"); map.put(4, null); outPrint.print...
public static void verbosePrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), false); }
MapUtils { public static void verbosePrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), false); } }
MapUtils { public static void verbosePrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), false); } private MapUtils(); }
MapUtils { public static void verbosePrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), false); } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); static String getString(final Map<? super K, ?> map...
MapUtils { public static void verbosePrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), false); } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); static String getString(final Map<? super K, ?> map...
@Test public void testDebugPrintNullLabel() { final ByteArrayOutputStream out = new ByteArrayOutputStream(); final PrintStream outPrint = new PrintStream(out); final String INDENT = " "; final Map<Integer, String> map = new TreeMap<Integer, String>(); map.put(2, "B"); map.put(3, "C"); map.put(4, null); outPrint.println...
public static void debugPrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), true); }
MapUtils { public static void debugPrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), true); } }
MapUtils { public static void debugPrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), true); } private MapUtils(); }
MapUtils { public static void debugPrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), true); } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); static String getString(final Map<? super K, ?> map, f...
MapUtils { public static void debugPrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), true); } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); static String getString(final Map<? super K, ?> map, f...
@Test public void testVerbosePrintNullLabelAndMap() { final ByteArrayOutputStream out = new ByteArrayOutputStream(); final PrintStream outPrint = new PrintStream(out); outPrint.println("null"); final String EXPECTED_OUT = out.toString(); out.reset(); MapUtils.verbosePrint(outPrint, null, null); assertEquals(EXPECTED_OU...
public static void verbosePrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), false); }
MapUtils { public static void verbosePrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), false); } }
MapUtils { public static void verbosePrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), false); } private MapUtils(); }
MapUtils { public static void verbosePrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), false); } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); static String getString(final Map<? super K, ?> map...
MapUtils { public static void verbosePrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), false); } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); static String getString(final Map<? super K, ?> map...
@Test public void testDebugPrintNullLabelAndMap() { final ByteArrayOutputStream out = new ByteArrayOutputStream(); final PrintStream outPrint = new PrintStream(out); outPrint.println("null"); final String EXPECTED_OUT = out.toString(); out.reset(); MapUtils.debugPrint(outPrint, null, null); assertEquals(EXPECTED_OUT, o...
public static void debugPrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), true); }
MapUtils { public static void debugPrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), true); } }
MapUtils { public static void debugPrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), true); } private MapUtils(); }
MapUtils { public static void debugPrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), true); } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); static String getString(final Map<? super K, ?> map, f...
MapUtils { public static void debugPrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), true); } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); static String getString(final Map<? super K, ?> map, f...
@Test public void testVerbosePrintNullStream() { try { MapUtils.verbosePrint(null, "Map", new HashMap<Object, Object>()); fail("Should generate NullPointerException"); } catch (final NullPointerException expected) { } }
public static void verbosePrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), false); }
MapUtils { public static void verbosePrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), false); } }
MapUtils { public static void verbosePrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), false); } private MapUtils(); }
MapUtils { public static void verbosePrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), false); } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); static String getString(final Map<? super K, ?> map...
MapUtils { public static void verbosePrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), false); } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); static String getString(final Map<? super K, ?> map...
@Test public void testDebugPrintNullStream() { try { MapUtils.debugPrint(null, "Map", new HashMap<Object, Object>()); fail("Should generate NullPointerException"); } catch (final NullPointerException expected) { } }
public static void debugPrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), true); }
MapUtils { public static void debugPrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), true); } }
MapUtils { public static void debugPrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), true); } private MapUtils(); }
MapUtils { public static void debugPrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), true); } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); static String getString(final Map<? super K, ?> map, f...
MapUtils { public static void debugPrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), true); } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); static String getString(final Map<? super K, ?> map, f...
@Test public void testDebugPrintNullKey() { final ByteArrayOutputStream out = new ByteArrayOutputStream(); final PrintStream outPrint = new PrintStream(out); final String INDENT = " "; final Map<Object, String> map = new HashMap<Object, String>(); map.put(null, "A"); outPrint.println("{"); outPrint.println(INDENT + "nu...
public static void debugPrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), true); }
MapUtils { public static void debugPrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), true); } }
MapUtils { public static void debugPrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), true); } private MapUtils(); }
MapUtils { public static void debugPrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), true); } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); static String getString(final Map<? super K, ?> map, f...
MapUtils { public static void debugPrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), true); } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); static String getString(final Map<? super K, ?> map, f...
@Test public void testExecuteReturnIntegerArray() throws Exception { TypeToken<List<User>> pt = new TypeToken<List<User>>() { }; TypeToken<Integer[]> rt = TypeToken.of(Integer[].class); String srcSql = "update user set name=:1.name where id=:1.id"; AbstractOperator operator = getOperator(pt, rt, srcSql); final int[] ex...
@Override public Object execute(Object[] values, InvocationStat stat) { Iterables iterables = getIterables(values); if (iterables.isEmpty()) { return transformer.transform(new int[]{}); } Map<DataSource, Group> gorupMap = new HashMap<DataSource, Group>(); int t = 0; for (Object obj : iterables) { InvocationContext cont...
BatchUpdateOperator extends AbstractOperator { @Override public Object execute(Object[] values, InvocationStat stat) { Iterables iterables = getIterables(values); if (iterables.isEmpty()) { return transformer.transform(new int[]{}); } Map<DataSource, Group> gorupMap = new HashMap<DataSource, Group>(); int t = 0; for (O...
BatchUpdateOperator extends AbstractOperator { @Override public Object execute(Object[] values, InvocationStat stat) { Iterables iterables = getIterables(values); if (iterables.isEmpty()) { return transformer.transform(new int[]{}); } Map<DataSource, Group> gorupMap = new HashMap<DataSource, Group>(); int t = 0; for (O...
BatchUpdateOperator extends AbstractOperator { @Override public Object execute(Object[] values, InvocationStat stat) { Iterables iterables = getIterables(values); if (iterables.isEmpty()) { return transformer.transform(new int[]{}); } Map<DataSource, Group> gorupMap = new HashMap<DataSource, Group>(); int t = 0; for (O...
BatchUpdateOperator extends AbstractOperator { @Override public Object execute(Object[] values, InvocationStat stat) { Iterables iterables = getIterables(values); if (iterables.isEmpty()) { return transformer.transform(new int[]{}); } Map<DataSource, Group> gorupMap = new HashMap<DataSource, Group>(); int t = 0; for (O...
@Test public void testVerbosePrintNullKey() { final ByteArrayOutputStream out = new ByteArrayOutputStream(); final PrintStream outPrint = new PrintStream(out); final String INDENT = " "; final Map<Object, String> map = new HashMap<Object, String>(); map.put(null, "A"); outPrint.println("{"); outPrint.println(INDENT + "...
public static void verbosePrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), false); }
MapUtils { public static void verbosePrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), false); } }
MapUtils { public static void verbosePrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), false); } private MapUtils(); }
MapUtils { public static void verbosePrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), false); } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); static String getString(final Map<? super K, ?> map...
MapUtils { public static void verbosePrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), false); } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); static String getString(final Map<? super K, ?> map...
@Test public void testDebugPrintNullKeyToMap1() { final ByteArrayOutputStream out = new ByteArrayOutputStream(); final PrintStream outPrint = new PrintStream(out); final String INDENT = " "; final Map<Object, Map<?, ?>> map = new HashMap<Object, Map<?, ?>>(); map.put(null, map); outPrint.println("{"); outPrint.println(...
public static void debugPrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), true); }
MapUtils { public static void debugPrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), true); } }
MapUtils { public static void debugPrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), true); } private MapUtils(); }
MapUtils { public static void debugPrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), true); } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); static String getString(final Map<? super K, ?> map, f...
MapUtils { public static void debugPrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), true); } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); static String getString(final Map<? super K, ?> map, f...
@Test public void testVerbosePrintNullKeyToMap1() { final ByteArrayOutputStream out = new ByteArrayOutputStream(); final PrintStream outPrint = new PrintStream(out); final String INDENT = " "; final Map<Object, Map<?, ?>> map = new HashMap<Object, Map<?, ?>>(); map.put(null, map); outPrint.println("{"); outPrint.printl...
public static void verbosePrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), false); }
MapUtils { public static void verbosePrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), false); } }
MapUtils { public static void verbosePrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), false); } private MapUtils(); }
MapUtils { public static void verbosePrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), false); } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); static String getString(final Map<? super K, ?> map...
MapUtils { public static void verbosePrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), false); } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); static String getString(final Map<? super K, ?> map...
@Test public void testDebugPrintNullKeyToMap2() { final ByteArrayOutputStream out = new ByteArrayOutputStream(); final PrintStream outPrint = new PrintStream(out); final String INDENT = " "; final Map<Object, Object> map = new HashMap<Object, Object>(); final Map<Object, Object> map2= new HashMap<Object, Object>(); map...
public static void debugPrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), true); }
MapUtils { public static void debugPrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), true); } }
MapUtils { public static void debugPrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), true); } private MapUtils(); }
MapUtils { public static void debugPrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), true); } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); static String getString(final Map<? super K, ?> map, f...
MapUtils { public static void debugPrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), true); } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); static String getString(final Map<? super K, ?> map, f...
@Test public void testVerbosePrintNullKeyToMap2() { final ByteArrayOutputStream out = new ByteArrayOutputStream(); final PrintStream outPrint = new PrintStream(out); final String INDENT = " "; final Map<Object, Object> map = new HashMap<Object, Object>(); final Map<Object, Object> map2= new HashMap<Object, Object>(); m...
public static void verbosePrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), false); }
MapUtils { public static void verbosePrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), false); } }
MapUtils { public static void verbosePrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), false); } private MapUtils(); }
MapUtils { public static void verbosePrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), false); } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); static String getString(final Map<? super K, ?> map...
MapUtils { public static void verbosePrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), false); } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); static String getString(final Map<? super K, ?> map...
@Test public void testVerbosePrint() { final ByteArrayOutputStream out = new ByteArrayOutputStream(); final PrintStream outPrint = new PrintStream(out); final String LABEL = "Print Map"; final String INDENT = " "; outPrint.println(LABEL + " = "); outPrint.println("{"); outPrint.println(INDENT + "0 = A"); outPrint.print...
public static void verbosePrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), false); }
MapUtils { public static void verbosePrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), false); } }
MapUtils { public static void verbosePrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), false); } private MapUtils(); }
MapUtils { public static void verbosePrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), false); } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); static String getString(final Map<? super K, ?> map...
MapUtils { public static void verbosePrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), false); } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); static String getString(final Map<? super K, ?> map...
@Test public void testDebugPrint() { final ByteArrayOutputStream out = new ByteArrayOutputStream(); final PrintStream outPrint = new PrintStream(out); final String LABEL = "Print Map"; final String INDENT = " "; outPrint.println(LABEL + " = "); outPrint.println("{"); outPrint.println(INDENT + "0 = A " + String.class.ge...
public static void debugPrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), true); }
MapUtils { public static void debugPrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), true); } }
MapUtils { public static void debugPrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), true); } private MapUtils(); }
MapUtils { public static void debugPrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), true); } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); static String getString(final Map<? super K, ?> map, f...
MapUtils { public static void debugPrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), true); } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); static String getString(final Map<? super K, ?> map, f...
@Test public void testVerbosePrintSelfReference() { final ByteArrayOutputStream out = new ByteArrayOutputStream(); final PrintStream outPrint = new PrintStream(out); final String LABEL = "Print Map"; final String INDENT = " "; final Map<Integer, Object> grandfather = new TreeMap<Integer, Object>(); final Map<Integer, O...
public static void verbosePrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), false); }
MapUtils { public static void verbosePrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), false); } }
MapUtils { public static void verbosePrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), false); } private MapUtils(); }
MapUtils { public static void verbosePrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), false); } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); static String getString(final Map<? super K, ?> map...
MapUtils { public static void verbosePrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), false); } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); static String getString(final Map<? super K, ?> map...
@Test public void testDebugPrintSelfReference() { final ByteArrayOutputStream out = new ByteArrayOutputStream(); final PrintStream outPrint = new PrintStream(out); final String LABEL = "Print Map"; final String INDENT = " "; final Map<Integer, Object> grandfather = new TreeMap<Integer, Object>(); final Map<Integer, Obj...
public static void debugPrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), true); }
MapUtils { public static void debugPrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), true); } }
MapUtils { public static void debugPrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), true); } private MapUtils(); }
MapUtils { public static void debugPrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), true); } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); static String getString(final Map<? super K, ?> map, f...
MapUtils { public static void debugPrint(final PrintStream out, final Object label, final Map<?, ?> map) { verbosePrintInternal(out, label, map, new ArrayDeque<Map<?, ?>>(), true); } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); static String getString(final Map<? super K, ?> map, f...
@Test public void testEmptyIfNull() { assertTrue(MapUtils.emptyIfNull(null).isEmpty()); final Map<Long, Long> map = new HashMap<Long, Long>(); assertSame(map, MapUtils.emptyIfNull(map)); }
public static <K,V> Map<K,V> emptyIfNull(final Map<K,V> map) { return map == null ? Collections.<K,V>emptyMap() : map; }
MapUtils { public static <K,V> Map<K,V> emptyIfNull(final Map<K,V> map) { return map == null ? Collections.<K,V>emptyMap() : map; } }
MapUtils { public static <K,V> Map<K,V> emptyIfNull(final Map<K,V> map) { return map == null ? Collections.<K,V>emptyMap() : map; } private MapUtils(); }
MapUtils { public static <K,V> Map<K,V> emptyIfNull(final Map<K,V> map) { return map == null ? Collections.<K,V>emptyMap() : map; } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); static String getString(final Map<? super K, ?> map, final K key); static Boolean getBoolean(final Map<? ...
MapUtils { public static <K,V> Map<K,V> emptyIfNull(final Map<K,V> map) { return map == null ? Collections.<K,V>emptyMap() : map; } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); static String getString(final Map<? super K, ?> map, final K key); static Boolean getBoolean(final Map<? ...
@Test public void testExecuteMulti() throws Exception { TypeToken<List<User>> pt = new TypeToken<List<User>>() { }; TypeToken<int[]> rt = TypeToken.of(int[].class); String srcSql = "update #table set name=:1.name where id=:1.id"; AbstractOperator operator = getOperator2(pt, rt, srcSql); operator.setJdbcOperations(new J...
@Override public Object execute(Object[] values, InvocationStat stat) { Iterables iterables = getIterables(values); if (iterables.isEmpty()) { return transformer.transform(new int[]{}); } Map<DataSource, Group> gorupMap = new HashMap<DataSource, Group>(); int t = 0; for (Object obj : iterables) { InvocationContext cont...
BatchUpdateOperator extends AbstractOperator { @Override public Object execute(Object[] values, InvocationStat stat) { Iterables iterables = getIterables(values); if (iterables.isEmpty()) { return transformer.transform(new int[]{}); } Map<DataSource, Group> gorupMap = new HashMap<DataSource, Group>(); int t = 0; for (O...
BatchUpdateOperator extends AbstractOperator { @Override public Object execute(Object[] values, InvocationStat stat) { Iterables iterables = getIterables(values); if (iterables.isEmpty()) { return transformer.transform(new int[]{}); } Map<DataSource, Group> gorupMap = new HashMap<DataSource, Group>(); int t = 0; for (O...
BatchUpdateOperator extends AbstractOperator { @Override public Object execute(Object[] values, InvocationStat stat) { Iterables iterables = getIterables(values); if (iterables.isEmpty()) { return transformer.transform(new int[]{}); } Map<DataSource, Group> gorupMap = new HashMap<DataSource, Group>(); int t = 0; for (O...
BatchUpdateOperator extends AbstractOperator { @Override public Object execute(Object[] values, InvocationStat stat) { Iterables iterables = getIterables(values); if (iterables.isEmpty()) { return transformer.transform(new int[]{}); } Map<DataSource, Group> gorupMap = new HashMap<DataSource, Group>(); int t = 0; for (O...
@Test public void testIsEmptyWithEmptyMap() { final Map<Object, Object> map = new HashMap<Object, Object>(); assertEquals(true, MapUtils.isEmpty(map)); }
public static boolean isEmpty(final Map<?,?> map) { return map == null || map.isEmpty(); }
MapUtils { public static boolean isEmpty(final Map<?,?> map) { return map == null || map.isEmpty(); } }
MapUtils { public static boolean isEmpty(final Map<?,?> map) { return map == null || map.isEmpty(); } private MapUtils(); }
MapUtils { public static boolean isEmpty(final Map<?,?> map) { return map == null || map.isEmpty(); } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); static String getString(final Map<? super K, ?> map, final K key); static Boolean getBoolean(final Map<? super K, ?> map, final K key);...
MapUtils { public static boolean isEmpty(final Map<?,?> map) { return map == null || map.isEmpty(); } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); static String getString(final Map<? super K, ?> map, final K key); static Boolean getBoolean(final Map<? super K, ?> map, final K key);...
@Test public void testIsEmptyWithNonEmptyMap() { final Map<String, String> map = new HashMap<String, String>(); map.put("item", "value"); assertEquals(false, MapUtils.isEmpty(map)); }
public static boolean isEmpty(final Map<?,?> map) { return map == null || map.isEmpty(); }
MapUtils { public static boolean isEmpty(final Map<?,?> map) { return map == null || map.isEmpty(); } }
MapUtils { public static boolean isEmpty(final Map<?,?> map) { return map == null || map.isEmpty(); } private MapUtils(); }
MapUtils { public static boolean isEmpty(final Map<?,?> map) { return map == null || map.isEmpty(); } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); static String getString(final Map<? super K, ?> map, final K key); static Boolean getBoolean(final Map<? super K, ?> map, final K key);...
MapUtils { public static boolean isEmpty(final Map<?,?> map) { return map == null || map.isEmpty(); } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); static String getString(final Map<? super K, ?> map, final K key); static Boolean getBoolean(final Map<? super K, ?> map, final K key);...
@Test public void testIsEmptyWithNull() { final Map<Object, Object> map = null; assertEquals(true, MapUtils.isEmpty(map)); }
public static boolean isEmpty(final Map<?,?> map) { return map == null || map.isEmpty(); }
MapUtils { public static boolean isEmpty(final Map<?,?> map) { return map == null || map.isEmpty(); } }
MapUtils { public static boolean isEmpty(final Map<?,?> map) { return map == null || map.isEmpty(); } private MapUtils(); }
MapUtils { public static boolean isEmpty(final Map<?,?> map) { return map == null || map.isEmpty(); } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); static String getString(final Map<? super K, ?> map, final K key); static Boolean getBoolean(final Map<? super K, ?> map, final K key);...
MapUtils { public static boolean isEmpty(final Map<?,?> map) { return map == null || map.isEmpty(); } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); static String getString(final Map<? super K, ?> map, final K key); static Boolean getBoolean(final Map<? super K, ?> map, final K key);...
@Test public void testIsNotEmptyWithEmptyMap() { final Map<Object, Object> map = new HashMap<Object, Object>(); assertEquals(false, MapUtils.isNotEmpty(map)); }
public static boolean isNotEmpty(final Map<?,?> map) { return !MapUtils.isEmpty(map); }
MapUtils { public static boolean isNotEmpty(final Map<?,?> map) { return !MapUtils.isEmpty(map); } }
MapUtils { public static boolean isNotEmpty(final Map<?,?> map) { return !MapUtils.isEmpty(map); } private MapUtils(); }
MapUtils { public static boolean isNotEmpty(final Map<?,?> map) { return !MapUtils.isEmpty(map); } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); static String getString(final Map<? super K, ?> map, final K key); static Boolean getBoolean(final Map<? super K, ?> map, final K key); st...
MapUtils { public static boolean isNotEmpty(final Map<?,?> map) { return !MapUtils.isEmpty(map); } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); static String getString(final Map<? super K, ?> map, final K key); static Boolean getBoolean(final Map<? super K, ?> map, final K key); st...
@Test public void testIsNotEmptyWithNonEmptyMap() { final Map<String, String> map = new HashMap<String, String>(); map.put("item", "value"); assertEquals(true, MapUtils.isNotEmpty(map)); }
public static boolean isNotEmpty(final Map<?,?> map) { return !MapUtils.isEmpty(map); }
MapUtils { public static boolean isNotEmpty(final Map<?,?> map) { return !MapUtils.isEmpty(map); } }
MapUtils { public static boolean isNotEmpty(final Map<?,?> map) { return !MapUtils.isEmpty(map); } private MapUtils(); }
MapUtils { public static boolean isNotEmpty(final Map<?,?> map) { return !MapUtils.isEmpty(map); } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); static String getString(final Map<? super K, ?> map, final K key); static Boolean getBoolean(final Map<? super K, ?> map, final K key); st...
MapUtils { public static boolean isNotEmpty(final Map<?,?> map) { return !MapUtils.isEmpty(map); } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); static String getString(final Map<? super K, ?> map, final K key); static Boolean getBoolean(final Map<? super K, ?> map, final K key); st...
@Test public void testIsNotEmptyWithNull() { final Map<Object, Object> map = null; assertEquals(false, MapUtils.isNotEmpty(map)); }
public static boolean isNotEmpty(final Map<?,?> map) { return !MapUtils.isEmpty(map); }
MapUtils { public static boolean isNotEmpty(final Map<?,?> map) { return !MapUtils.isEmpty(map); } }
MapUtils { public static boolean isNotEmpty(final Map<?,?> map) { return !MapUtils.isEmpty(map); } private MapUtils(); }
MapUtils { public static boolean isNotEmpty(final Map<?,?> map) { return !MapUtils.isEmpty(map); } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); static String getString(final Map<? super K, ?> map, final K key); static Boolean getBoolean(final Map<? super K, ?> map, final K key); st...
MapUtils { public static boolean isNotEmpty(final Map<?,?> map) { return !MapUtils.isEmpty(map); } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); static String getString(final Map<? super K, ?> map, final K key); static Boolean getBoolean(final Map<? super K, ?> map, final K key); st...
@Test public void testPopulateMap() { final List<String> list = new ArrayList<String>(); list.add("1"); list.add("3"); list.add("5"); list.add("7"); list.add("2"); list.add("4"); list.add("6"); Map<Object, Object> map = new HashMap<Object, Object>(); MapUtils.populateMap(map, list, TransformedCollectionTest.STRING_TO_I...
public static <K, V> void populateMap(final Map<K, V> map, final Iterable<? extends V> elements, final Transformer<V, K> keyTransformer) { populateMap(map, elements, keyTransformer, TransformerUtils.<V>nopTransformer()); }
MapUtils { public static <K, V> void populateMap(final Map<K, V> map, final Iterable<? extends V> elements, final Transformer<V, K> keyTransformer) { populateMap(map, elements, keyTransformer, TransformerUtils.<V>nopTransformer()); } }
MapUtils { public static <K, V> void populateMap(final Map<K, V> map, final Iterable<? extends V> elements, final Transformer<V, K> keyTransformer) { populateMap(map, elements, keyTransformer, TransformerUtils.<V>nopTransformer()); } private MapUtils(); }
MapUtils { public static <K, V> void populateMap(final Map<K, V> map, final Iterable<? extends V> elements, final Transformer<V, K> keyTransformer) { populateMap(map, elements, keyTransformer, TransformerUtils.<V>nopTransformer()); } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); sta...
MapUtils { public static <K, V> void populateMap(final Map<K, V> map, final Iterable<? extends V> elements, final Transformer<V, K> keyTransformer) { populateMap(map, elements, keyTransformer, TransformerUtils.<V>nopTransformer()); } private MapUtils(); static V getObject(final Map<? super K, V> map, final K key); sta...
@Test public void testIterableMap() { try { MapUtils.iterableMap(null); fail("Should throw NullPointerException"); } catch (final NullPointerException e) { } final HashMap<String, String> map = new HashMap<String, String>(); map.put("foo", "foov"); map.put("bar", "barv"); map.put("baz", "bazv"); final IterableMap<Strin...
public static <K, V> IterableMap<K, V> iterableMap(final Map<K, V> map) { if (map == null) { throw new NullPointerException("Map must not be null"); } return map instanceof IterableMap ? (IterableMap<K, V>) map : new AbstractMapDecorator<K, V>(map) {}; }
MapUtils { public static <K, V> IterableMap<K, V> iterableMap(final Map<K, V> map) { if (map == null) { throw new NullPointerException("Map must not be null"); } return map instanceof IterableMap ? (IterableMap<K, V>) map : new AbstractMapDecorator<K, V>(map) {}; } }
MapUtils { public static <K, V> IterableMap<K, V> iterableMap(final Map<K, V> map) { if (map == null) { throw new NullPointerException("Map must not be null"); } return map instanceof IterableMap ? (IterableMap<K, V>) map : new AbstractMapDecorator<K, V>(map) {}; } private MapUtils(); }
MapUtils { public static <K, V> IterableMap<K, V> iterableMap(final Map<K, V> map) { if (map == null) { throw new NullPointerException("Map must not be null"); } return map instanceof IterableMap ? (IterableMap<K, V>) map : new AbstractMapDecorator<K, V>(map) {}; } private MapUtils(); static V getObject(final Map<? su...
MapUtils { public static <K, V> IterableMap<K, V> iterableMap(final Map<K, V> map) { if (map == null) { throw new NullPointerException("Map must not be null"); } return map instanceof IterableMap ? (IterableMap<K, V>) map : new AbstractMapDecorator<K, V>(map) {}; } private MapUtils(); static V getObject(final Map<? su...
@Test public void testIterableSortedMap() { try { MapUtils.iterableSortedMap(null); fail("Should throw NullPointerException"); } catch (final NullPointerException e) { } final TreeMap<String, String> map = new TreeMap<String, String>(); map.put("foo", "foov"); map.put("bar", "barv"); map.put("baz", "bazv"); final Itera...
public static <K, V> IterableSortedMap<K, V> iterableSortedMap(final SortedMap<K, V> sortedMap) { if (sortedMap == null) { throw new NullPointerException("Map must not be null"); } return sortedMap instanceof IterableSortedMap ? (IterableSortedMap<K, V>) sortedMap : new AbstractSortedMapDecorator<K, V>(sortedMap) {}; }
MapUtils { public static <K, V> IterableSortedMap<K, V> iterableSortedMap(final SortedMap<K, V> sortedMap) { if (sortedMap == null) { throw new NullPointerException("Map must not be null"); } return sortedMap instanceof IterableSortedMap ? (IterableSortedMap<K, V>) sortedMap : new AbstractSortedMapDecorator<K, V>(sorte...
MapUtils { public static <K, V> IterableSortedMap<K, V> iterableSortedMap(final SortedMap<K, V> sortedMap) { if (sortedMap == null) { throw new NullPointerException("Map must not be null"); } return sortedMap instanceof IterableSortedMap ? (IterableSortedMap<K, V>) sortedMap : new AbstractSortedMapDecorator<K, V>(sorte...
MapUtils { public static <K, V> IterableSortedMap<K, V> iterableSortedMap(final SortedMap<K, V> sortedMap) { if (sortedMap == null) { throw new NullPointerException("Map must not be null"); } return sortedMap instanceof IterableSortedMap ? (IterableSortedMap<K, V>) sortedMap : new AbstractSortedMapDecorator<K, V>(sorte...
MapUtils { public static <K, V> IterableSortedMap<K, V> iterableSortedMap(final SortedMap<K, V> sortedMap) { if (sortedMap == null) { throw new NullPointerException("Map must not be null"); } return sortedMap instanceof IterableSortedMap ? (IterableSortedMap<K, V>) sortedMap : new AbstractSortedMapDecorator<K, V>(sorte...
@Test public void testIntersectNonEmptyWithEmptyList() { final List<String> empty = Collections.<String>emptyList(); assertTrue("result not empty", ListUtils.intersection(empty, fullList).isEmpty()); }
public static <E> List<E> intersection(final List<? extends E> list1, final List<? extends E> list2) { final List<E> result = new ArrayList<E>(); List<? extends E> smaller = list1; List<? extends E> larger = list2; if (list1.size() > list2.size()) { smaller = list2; larger = list1; } final HashSet<E> hashSet = new Hash...
ListUtils { public static <E> List<E> intersection(final List<? extends E> list1, final List<? extends E> list2) { final List<E> result = new ArrayList<E>(); List<? extends E> smaller = list1; List<? extends E> larger = list2; if (list1.size() > list2.size()) { smaller = list2; larger = list1; } final HashSet<E> hashSe...
ListUtils { public static <E> List<E> intersection(final List<? extends E> list1, final List<? extends E> list2) { final List<E> result = new ArrayList<E>(); List<? extends E> smaller = list1; List<? extends E> larger = list2; if (list1.size() > list2.size()) { smaller = list2; larger = list1; } final HashSet<E> hashSe...
ListUtils { public static <E> List<E> intersection(final List<? extends E> list1, final List<? extends E> list2) { final List<E> result = new ArrayList<E>(); List<? extends E> smaller = list1; List<? extends E> larger = list2; if (list1.size() > list2.size()) { smaller = list2; larger = list1; } final HashSet<E> hashSe...
ListUtils { public static <E> List<E> intersection(final List<? extends E> list1, final List<? extends E> list2) { final List<E> result = new ArrayList<E>(); List<? extends E> smaller = list1; List<? extends E> larger = list2; if (list1.size() > list2.size()) { smaller = list2; larger = list1; } final HashSet<E> hashSe...
@Test public void testStatsCounter() throws Exception { TypeToken<List<User>> pt = new TypeToken<List<User>>() { }; TypeToken<int[]> rt = TypeToken.of(int[].class); String srcSql = "update user set name=:1.name where id=:1.id"; AbstractOperator operator = getOperator(pt, rt, srcSql); operator.setJdbcOperations(new Jdbc...
@Override public Object execute(Object[] values, InvocationStat stat) { Iterables iterables = getIterables(values); if (iterables.isEmpty()) { return transformer.transform(new int[]{}); } Map<DataSource, Group> gorupMap = new HashMap<DataSource, Group>(); int t = 0; for (Object obj : iterables) { InvocationContext cont...
BatchUpdateOperator extends AbstractOperator { @Override public Object execute(Object[] values, InvocationStat stat) { Iterables iterables = getIterables(values); if (iterables.isEmpty()) { return transformer.transform(new int[]{}); } Map<DataSource, Group> gorupMap = new HashMap<DataSource, Group>(); int t = 0; for (O...
BatchUpdateOperator extends AbstractOperator { @Override public Object execute(Object[] values, InvocationStat stat) { Iterables iterables = getIterables(values); if (iterables.isEmpty()) { return transformer.transform(new int[]{}); } Map<DataSource, Group> gorupMap = new HashMap<DataSource, Group>(); int t = 0; for (O...
BatchUpdateOperator extends AbstractOperator { @Override public Object execute(Object[] values, InvocationStat stat) { Iterables iterables = getIterables(values); if (iterables.isEmpty()) { return transformer.transform(new int[]{}); } Map<DataSource, Group> gorupMap = new HashMap<DataSource, Group>(); int t = 0; for (O...
BatchUpdateOperator extends AbstractOperator { @Override public Object execute(Object[] values, InvocationStat stat) { Iterables iterables = getIterables(values); if (iterables.isEmpty()) { return transformer.transform(new int[]{}); } Map<DataSource, Group> gorupMap = new HashMap<DataSource, Group>(); int t = 0; for (O...
@Test public void testIntersectEmptyWithEmptyList() { final List<?> empty = Collections.EMPTY_LIST; assertTrue("result not empty", ListUtils.intersection(empty, empty).isEmpty()); }
public static <E> List<E> intersection(final List<? extends E> list1, final List<? extends E> list2) { final List<E> result = new ArrayList<E>(); List<? extends E> smaller = list1; List<? extends E> larger = list2; if (list1.size() > list2.size()) { smaller = list2; larger = list1; } final HashSet<E> hashSet = new Hash...
ListUtils { public static <E> List<E> intersection(final List<? extends E> list1, final List<? extends E> list2) { final List<E> result = new ArrayList<E>(); List<? extends E> smaller = list1; List<? extends E> larger = list2; if (list1.size() > list2.size()) { smaller = list2; larger = list1; } final HashSet<E> hashSe...
ListUtils { public static <E> List<E> intersection(final List<? extends E> list1, final List<? extends E> list2) { final List<E> result = new ArrayList<E>(); List<? extends E> smaller = list1; List<? extends E> larger = list2; if (list1.size() > list2.size()) { smaller = list2; larger = list1; } final HashSet<E> hashSe...
ListUtils { public static <E> List<E> intersection(final List<? extends E> list1, final List<? extends E> list2) { final List<E> result = new ArrayList<E>(); List<? extends E> smaller = list1; List<? extends E> larger = list2; if (list1.size() > list2.size()) { smaller = list2; larger = list1; } final HashSet<E> hashSe...
ListUtils { public static <E> List<E> intersection(final List<? extends E> list1, final List<? extends E> list2) { final List<E> result = new ArrayList<E>(); List<? extends E> smaller = list1; List<? extends E> larger = list2; if (list1.size() > list2.size()) { smaller = list2; larger = list1; } final HashSet<E> hashSe...
@Test public void testIntersectNonEmptySubset() { final List<String> other = new ArrayList<String>(fullList); assertNotNull(other.remove(0)); assertNotNull(other.remove(1)); assertEquals(other, ListUtils.intersection(fullList, other)); }
public static <E> List<E> intersection(final List<? extends E> list1, final List<? extends E> list2) { final List<E> result = new ArrayList<E>(); List<? extends E> smaller = list1; List<? extends E> larger = list2; if (list1.size() > list2.size()) { smaller = list2; larger = list1; } final HashSet<E> hashSet = new Hash...
ListUtils { public static <E> List<E> intersection(final List<? extends E> list1, final List<? extends E> list2) { final List<E> result = new ArrayList<E>(); List<? extends E> smaller = list1; List<? extends E> larger = list2; if (list1.size() > list2.size()) { smaller = list2; larger = list1; } final HashSet<E> hashSe...
ListUtils { public static <E> List<E> intersection(final List<? extends E> list1, final List<? extends E> list2) { final List<E> result = new ArrayList<E>(); List<? extends E> smaller = list1; List<? extends E> larger = list2; if (list1.size() > list2.size()) { smaller = list2; larger = list1; } final HashSet<E> hashSe...
ListUtils { public static <E> List<E> intersection(final List<? extends E> list1, final List<? extends E> list2) { final List<E> result = new ArrayList<E>(); List<? extends E> smaller = list1; List<? extends E> larger = list2; if (list1.size() > list2.size()) { smaller = list2; larger = list1; } final HashSet<E> hashSe...
ListUtils { public static <E> List<E> intersection(final List<? extends E> list1, final List<? extends E> list2) { final List<E> result = new ArrayList<E>(); List<? extends E> smaller = list1; List<? extends E> larger = list2; if (list1.size() > list2.size()) { smaller = list2; larger = list1; } final HashSet<E> hashSe...
@Test public void testIntersectListWithNoOverlapAndDifferentTypes() { @SuppressWarnings("boxing") final List<Integer> other = Arrays.asList(1, 23); assertTrue(ListUtils.intersection(fullList, other).isEmpty()); }
public static <E> List<E> intersection(final List<? extends E> list1, final List<? extends E> list2) { final List<E> result = new ArrayList<E>(); List<? extends E> smaller = list1; List<? extends E> larger = list2; if (list1.size() > list2.size()) { smaller = list2; larger = list1; } final HashSet<E> hashSet = new Hash...
ListUtils { public static <E> List<E> intersection(final List<? extends E> list1, final List<? extends E> list2) { final List<E> result = new ArrayList<E>(); List<? extends E> smaller = list1; List<? extends E> larger = list2; if (list1.size() > list2.size()) { smaller = list2; larger = list1; } final HashSet<E> hashSe...
ListUtils { public static <E> List<E> intersection(final List<? extends E> list1, final List<? extends E> list2) { final List<E> result = new ArrayList<E>(); List<? extends E> smaller = list1; List<? extends E> larger = list2; if (list1.size() > list2.size()) { smaller = list2; larger = list1; } final HashSet<E> hashSe...
ListUtils { public static <E> List<E> intersection(final List<? extends E> list1, final List<? extends E> list2) { final List<E> result = new ArrayList<E>(); List<? extends E> smaller = list1; List<? extends E> larger = list2; if (list1.size() > list2.size()) { smaller = list2; larger = list1; } final HashSet<E> hashSe...
ListUtils { public static <E> List<E> intersection(final List<? extends E> list1, final List<? extends E> list2) { final List<E> result = new ArrayList<E>(); List<? extends E> smaller = list1; List<? extends E> larger = list2; if (list1.size() > list2.size()) { smaller = list2; larger = list1; } final HashSet<E> hashSe...
@Test public void testIntersectListWithSelf() { assertEquals(fullList, ListUtils.intersection(fullList, fullList)); }
public static <E> List<E> intersection(final List<? extends E> list1, final List<? extends E> list2) { final List<E> result = new ArrayList<E>(); List<? extends E> smaller = list1; List<? extends E> larger = list2; if (list1.size() > list2.size()) { smaller = list2; larger = list1; } final HashSet<E> hashSet = new Hash...
ListUtils { public static <E> List<E> intersection(final List<? extends E> list1, final List<? extends E> list2) { final List<E> result = new ArrayList<E>(); List<? extends E> smaller = list1; List<? extends E> larger = list2; if (list1.size() > list2.size()) { smaller = list2; larger = list1; } final HashSet<E> hashSe...
ListUtils { public static <E> List<E> intersection(final List<? extends E> list1, final List<? extends E> list2) { final List<E> result = new ArrayList<E>(); List<? extends E> smaller = list1; List<? extends E> larger = list2; if (list1.size() > list2.size()) { smaller = list2; larger = list1; } final HashSet<E> hashSe...
ListUtils { public static <E> List<E> intersection(final List<? extends E> list1, final List<? extends E> list2) { final List<E> result = new ArrayList<E>(); List<? extends E> smaller = list1; List<? extends E> larger = list2; if (list1.size() > list2.size()) { smaller = list2; larger = list1; } final HashSet<E> hashSe...
ListUtils { public static <E> List<E> intersection(final List<? extends E> list1, final List<? extends E> list2) { final List<E> result = new ArrayList<E>(); List<? extends E> smaller = list1; List<? extends E> larger = list2; if (list1.size() > list2.size()) { smaller = list2; larger = list1; } final HashSet<E> hashSe...
@Test public void testIntersectionOrderInsensitivity() { final List<String> one = new ArrayList<String>(); final List<String> two = new ArrayList<String>(); one.add("a"); one.add("b"); two.add("a"); two.add("a"); two.add("b"); two.add("b"); assertEquals(ListUtils.intersection(one,two),ListUtils.intersection(two, one));...
public static <E> List<E> intersection(final List<? extends E> list1, final List<? extends E> list2) { final List<E> result = new ArrayList<E>(); List<? extends E> smaller = list1; List<? extends E> larger = list2; if (list1.size() > list2.size()) { smaller = list2; larger = list1; } final HashSet<E> hashSet = new Hash...
ListUtils { public static <E> List<E> intersection(final List<? extends E> list1, final List<? extends E> list2) { final List<E> result = new ArrayList<E>(); List<? extends E> smaller = list1; List<? extends E> larger = list2; if (list1.size() > list2.size()) { smaller = list2; larger = list1; } final HashSet<E> hashSe...
ListUtils { public static <E> List<E> intersection(final List<? extends E> list1, final List<? extends E> list2) { final List<E> result = new ArrayList<E>(); List<? extends E> smaller = list1; List<? extends E> larger = list2; if (list1.size() > list2.size()) { smaller = list2; larger = list1; } final HashSet<E> hashSe...
ListUtils { public static <E> List<E> intersection(final List<? extends E> list1, final List<? extends E> list2) { final List<E> result = new ArrayList<E>(); List<? extends E> smaller = list1; List<? extends E> larger = list2; if (list1.size() > list2.size()) { smaller = list2; larger = list1; } final HashSet<E> hashSe...
ListUtils { public static <E> List<E> intersection(final List<? extends E> list1, final List<? extends E> list2) { final List<E> result = new ArrayList<E>(); List<? extends E> smaller = list1; List<? extends E> larger = list2; if (list1.size() > list2.size()) { smaller = list2; larger = list1; } final HashSet<E> hashSe...
@Test public void testPredicatedList() { final Predicate<Object> predicate = new Predicate<Object>() { public boolean evaluate(final Object o) { return o instanceof String; } }; List<Object> list = ListUtils.predicatedList(new ArrayList<Object>(), predicate); assertTrue("returned object should be a PredicatedList", lis...
public static <E> List<E> predicatedList(final List<E> list, final Predicate<E> predicate) { return PredicatedList.predicatedList(list, predicate); }
ListUtils { public static <E> List<E> predicatedList(final List<E> list, final Predicate<E> predicate) { return PredicatedList.predicatedList(list, predicate); } }
ListUtils { public static <E> List<E> predicatedList(final List<E> list, final Predicate<E> predicate) { return PredicatedList.predicatedList(list, predicate); } private ListUtils(); }
ListUtils { public static <E> List<E> predicatedList(final List<E> list, final Predicate<E> predicate) { return PredicatedList.predicatedList(list, predicate); } private ListUtils(); static List<T> emptyIfNull(final List<T> list); static List<T> defaultIfNull(final List<T> list, final List<T> defaultList); static List...
ListUtils { public static <E> List<E> predicatedList(final List<E> list, final Predicate<E> predicate) { return PredicatedList.predicatedList(list, predicate); } private ListUtils(); static List<T> emptyIfNull(final List<T> list); static List<T> defaultIfNull(final List<T> list, final List<T> defaultList); static List...
@Test public void testLazyList() { final List<Integer> list = ListUtils.lazyList(new ArrayList<Integer>(), new Factory<Integer>() { private int index; public Integer create() { index++; return Integer.valueOf(index); } }); assertNotNull(list.get(5)); assertEquals(6, list.size()); assertNotNull(list.get(5)); assertEqual...
public static <E> List<E> lazyList(final List<E> list, final Factory<? extends E> factory) { return LazyList.lazyList(list, factory); }
ListUtils { public static <E> List<E> lazyList(final List<E> list, final Factory<? extends E> factory) { return LazyList.lazyList(list, factory); } }
ListUtils { public static <E> List<E> lazyList(final List<E> list, final Factory<? extends E> factory) { return LazyList.lazyList(list, factory); } private ListUtils(); }
ListUtils { public static <E> List<E> lazyList(final List<E> list, final Factory<? extends E> factory) { return LazyList.lazyList(list, factory); } private ListUtils(); static List<T> emptyIfNull(final List<T> list); static List<T> defaultIfNull(final List<T> list, final List<T> defaultList); static List<E> intersecti...
ListUtils { public static <E> List<E> lazyList(final List<E> list, final Factory<? extends E> factory) { return LazyList.lazyList(list, factory); } private ListUtils(); static List<T> emptyIfNull(final List<T> list); static List<T> defaultIfNull(final List<T> list, final List<T> defaultList); static List<E> intersecti...
@Test public void testEmptyIfNull() { assertTrue(ListUtils.emptyIfNull(null).isEmpty()); final List<Long> list = new ArrayList<Long>(); assertSame(list, ListUtils.emptyIfNull(list)); }
public static <T> List<T> emptyIfNull(final List<T> list) { return list == null ? Collections.<T>emptyList() : list; }
ListUtils { public static <T> List<T> emptyIfNull(final List<T> list) { return list == null ? Collections.<T>emptyList() : list; } }
ListUtils { public static <T> List<T> emptyIfNull(final List<T> list) { return list == null ? Collections.<T>emptyList() : list; } private ListUtils(); }
ListUtils { public static <T> List<T> emptyIfNull(final List<T> list) { return list == null ? Collections.<T>emptyList() : list; } private ListUtils(); static List<T> emptyIfNull(final List<T> list); static List<T> defaultIfNull(final List<T> list, final List<T> defaultList); static List<E> intersection(final List<? e...
ListUtils { public static <T> List<T> emptyIfNull(final List<T> list) { return list == null ? Collections.<T>emptyList() : list; } private ListUtils(); static List<T> emptyIfNull(final List<T> list); static List<T> defaultIfNull(final List<T> list, final List<T> defaultList); static List<E> intersection(final List<? e...
@Test public void testDefaultIfNull() { assertTrue(ListUtils.defaultIfNull(null, Collections.emptyList()).isEmpty()); final List<Long> list = new ArrayList<Long>(); assertSame(list, ListUtils.defaultIfNull(list, Collections.<Long>emptyList())); }
public static <T> List<T> defaultIfNull(final List<T> list, final List<T> defaultList) { return list == null ? defaultList : list; }
ListUtils { public static <T> List<T> defaultIfNull(final List<T> list, final List<T> defaultList) { return list == null ? defaultList : list; } }
ListUtils { public static <T> List<T> defaultIfNull(final List<T> list, final List<T> defaultList) { return list == null ? defaultList : list; } private ListUtils(); }
ListUtils { public static <T> List<T> defaultIfNull(final List<T> list, final List<T> defaultList) { return list == null ? defaultList : list; } private ListUtils(); static List<T> emptyIfNull(final List<T> list); static List<T> defaultIfNull(final List<T> list, final List<T> defaultList); static List<E> intersection(...
ListUtils { public static <T> List<T> defaultIfNull(final List<T> list, final List<T> defaultList) { return list == null ? defaultList : list; } private ListUtils(); static List<T> emptyIfNull(final List<T> list); static List<T> defaultIfNull(final List<T> list, final List<T> defaultList); static List<E> intersection(...
@Test public void testEquals() { final Collection<String> data = Arrays.asList("a", "b", "c"); final List<String> a = new ArrayList<String>( data ); final List<String> b = new ArrayList<String>( data ); assertEquals(true, a.equals(b)); assertEquals(true, ListUtils.isEqualList(a, b)); a.clear(); assertEquals(false, List...
public static boolean isEqualList(final Collection<?> list1, final Collection<?> list2) { if (list1 == list2) { return true; } if (list1 == null || list2 == null || list1.size() != list2.size()) { return false; } final Iterator<?> it1 = list1.iterator(); final Iterator<?> it2 = list2.iterator(); Object obj1 = null; Obj...
ListUtils { public static boolean isEqualList(final Collection<?> list1, final Collection<?> list2) { if (list1 == list2) { return true; } if (list1 == null || list2 == null || list1.size() != list2.size()) { return false; } final Iterator<?> it1 = list1.iterator(); final Iterator<?> it2 = list2.iterator(); Object obj1...
ListUtils { public static boolean isEqualList(final Collection<?> list1, final Collection<?> list2) { if (list1 == list2) { return true; } if (list1 == null || list2 == null || list1.size() != list2.size()) { return false; } final Iterator<?> it1 = list1.iterator(); final Iterator<?> it2 = list2.iterator(); Object obj1...
ListUtils { public static boolean isEqualList(final Collection<?> list1, final Collection<?> list2) { if (list1 == list2) { return true; } if (list1 == null || list2 == null || list1.size() != list2.size()) { return false; } final Iterator<?> it1 = list1.iterator(); final Iterator<?> it2 = list2.iterator(); Object obj1...
ListUtils { public static boolean isEqualList(final Collection<?> list1, final Collection<?> list2) { if (list1 == list2) { return true; } if (list1 == null || list2 == null || list1.size() != list2.size()) { return false; } final Iterator<?> it1 = list1.iterator(); final Iterator<?> it2 = list2.iterator(); Object obj1...
@Test public void testExecuteReturnTypeError() throws Exception { thrown.expect(DescriptionException.class); thrown.expectMessage("the return type of batch update expected one of " + "[void, int, int[], Void, Integer, Integer[]] but class java.lang.String"); TypeToken<List<User>> pt = new TypeToken<List<User>>() { }; T...
@Override public Object execute(Object[] values, InvocationStat stat) { Iterables iterables = getIterables(values); if (iterables.isEmpty()) { return transformer.transform(new int[]{}); } Map<DataSource, Group> gorupMap = new HashMap<DataSource, Group>(); int t = 0; for (Object obj : iterables) { InvocationContext cont...
BatchUpdateOperator extends AbstractOperator { @Override public Object execute(Object[] values, InvocationStat stat) { Iterables iterables = getIterables(values); if (iterables.isEmpty()) { return transformer.transform(new int[]{}); } Map<DataSource, Group> gorupMap = new HashMap<DataSource, Group>(); int t = 0; for (O...
BatchUpdateOperator extends AbstractOperator { @Override public Object execute(Object[] values, InvocationStat stat) { Iterables iterables = getIterables(values); if (iterables.isEmpty()) { return transformer.transform(new int[]{}); } Map<DataSource, Group> gorupMap = new HashMap<DataSource, Group>(); int t = 0; for (O...
BatchUpdateOperator extends AbstractOperator { @Override public Object execute(Object[] values, InvocationStat stat) { Iterables iterables = getIterables(values); if (iterables.isEmpty()) { return transformer.transform(new int[]{}); } Map<DataSource, Group> gorupMap = new HashMap<DataSource, Group>(); int t = 0; for (O...
BatchUpdateOperator extends AbstractOperator { @Override public Object execute(Object[] values, InvocationStat stat) { Iterables iterables = getIterables(values); if (iterables.isEmpty()) { return transformer.transform(new int[]{}); } Map<DataSource, Group> gorupMap = new HashMap<DataSource, Group>(); int t = 0; for (O...
@Test public void testHashCode() { final Collection<String> data = Arrays.asList("a", "b", "c"); final List<String> a = new ArrayList<String>(data); final List<String> b = new ArrayList<String>(data); assertEquals(true, a.hashCode() == b.hashCode()); assertEquals(true, a.hashCode() == ListUtils.hashCodeForList(a)); ass...
public static int hashCodeForList(final Collection<?> list) { if (list == null) { return 0; } int hashCode = 1; final Iterator<?> it = list.iterator(); while (it.hasNext()) { final Object obj = it.next(); hashCode = 31 * hashCode + (obj == null ? 0 : obj.hashCode()); } return hashCode; }
ListUtils { public static int hashCodeForList(final Collection<?> list) { if (list == null) { return 0; } int hashCode = 1; final Iterator<?> it = list.iterator(); while (it.hasNext()) { final Object obj = it.next(); hashCode = 31 * hashCode + (obj == null ? 0 : obj.hashCode()); } return hashCode; } }
ListUtils { public static int hashCodeForList(final Collection<?> list) { if (list == null) { return 0; } int hashCode = 1; final Iterator<?> it = list.iterator(); while (it.hasNext()) { final Object obj = it.next(); hashCode = 31 * hashCode + (obj == null ? 0 : obj.hashCode()); } return hashCode; } private ListUtils(...
ListUtils { public static int hashCodeForList(final Collection<?> list) { if (list == null) { return 0; } int hashCode = 1; final Iterator<?> it = list.iterator(); while (it.hasNext()) { final Object obj = it.next(); hashCode = 31 * hashCode + (obj == null ? 0 : obj.hashCode()); } return hashCode; } private ListUtils(...
ListUtils { public static int hashCodeForList(final Collection<?> list) { if (list == null) { return 0; } int hashCode = 1; final Iterator<?> it = list.iterator(); while (it.hasNext()) { final Object obj = it.next(); hashCode = 31 * hashCode + (obj == null ? 0 : obj.hashCode()); } return hashCode; } private ListUtils(...
@Test public void testRetainAll() { final List<String> sub = new ArrayList<String>(); sub.add(a); sub.add(b); sub.add(x); final List<String> retained = ListUtils.retainAll(fullList, sub); assertTrue(retained.size() == 2); sub.remove(x); assertTrue(retained.equals(sub)); fullList.retainAll(sub); assertTrue(retained.equa...
public static <E> List<E> retainAll(final Collection<E> collection, final Collection<?> retain) { final List<E> list = new ArrayList<E>(Math.min(collection.size(), retain.size())); for (final E obj : collection) { if (retain.contains(obj)) { list.add(obj); } } return list; }
ListUtils { public static <E> List<E> retainAll(final Collection<E> collection, final Collection<?> retain) { final List<E> list = new ArrayList<E>(Math.min(collection.size(), retain.size())); for (final E obj : collection) { if (retain.contains(obj)) { list.add(obj); } } return list; } }
ListUtils { public static <E> List<E> retainAll(final Collection<E> collection, final Collection<?> retain) { final List<E> list = new ArrayList<E>(Math.min(collection.size(), retain.size())); for (final E obj : collection) { if (retain.contains(obj)) { list.add(obj); } } return list; } private ListUtils(); }
ListUtils { public static <E> List<E> retainAll(final Collection<E> collection, final Collection<?> retain) { final List<E> list = new ArrayList<E>(Math.min(collection.size(), retain.size())); for (final E obj : collection) { if (retain.contains(obj)) { list.add(obj); } } return list; } private ListUtils(); static Lis...
ListUtils { public static <E> List<E> retainAll(final Collection<E> collection, final Collection<?> retain) { final List<E> list = new ArrayList<E>(Math.min(collection.size(), retain.size())); for (final E obj : collection) { if (retain.contains(obj)) { list.add(obj); } } return list; } private ListUtils(); static Lis...
@Test public void testRemoveAll() { final List<String> sub = new ArrayList<String>(); sub.add(a); sub.add(b); sub.add(x); final List<String> remainder = ListUtils.removeAll(fullList, sub); assertTrue(remainder.size() == 3); fullList.removeAll(sub); assertTrue(remainder.equals(fullList)); try { ListUtils.removeAll(null,...
public static <E> List<E> removeAll(final Collection<E> collection, final Collection<?> remove) { final List<E> list = new ArrayList<E>(); for (final E obj : collection) { if (!remove.contains(obj)) { list.add(obj); } } return list; }
ListUtils { public static <E> List<E> removeAll(final Collection<E> collection, final Collection<?> remove) { final List<E> list = new ArrayList<E>(); for (final E obj : collection) { if (!remove.contains(obj)) { list.add(obj); } } return list; } }
ListUtils { public static <E> List<E> removeAll(final Collection<E> collection, final Collection<?> remove) { final List<E> list = new ArrayList<E>(); for (final E obj : collection) { if (!remove.contains(obj)) { list.add(obj); } } return list; } private ListUtils(); }
ListUtils { public static <E> List<E> removeAll(final Collection<E> collection, final Collection<?> remove) { final List<E> list = new ArrayList<E>(); for (final E obj : collection) { if (!remove.contains(obj)) { list.add(obj); } } return list; } private ListUtils(); static List<T> emptyIfNull(final List<T> list); sta...
ListUtils { public static <E> List<E> removeAll(final Collection<E> collection, final Collection<?> remove) { final List<E> list = new ArrayList<E>(); for (final E obj : collection) { if (!remove.contains(obj)) { list.add(obj); } } return list; } private ListUtils(); static List<T> emptyIfNull(final List<T> list); sta...
@Test public void testSubtract() { final List<String> list = new ArrayList<String>(); list.add(a); list.add(b); list.add(a); list.add(x); final List<String> sub = new ArrayList<String>(); sub.add(a); final List<String> result = ListUtils.subtract(list, sub); assertTrue(result.size() == 3); final List<String> expected =...
public static <E> List<E> subtract(final List<E> list1, final List<? extends E> list2) { final ArrayList<E> result = new ArrayList<E>(); final HashBag<E> bag = new HashBag<E>(list2); for (final E e : list1) { if (!bag.remove(e, 1)) { result.add(e); } } return result; }
ListUtils { public static <E> List<E> subtract(final List<E> list1, final List<? extends E> list2) { final ArrayList<E> result = new ArrayList<E>(); final HashBag<E> bag = new HashBag<E>(list2); for (final E e : list1) { if (!bag.remove(e, 1)) { result.add(e); } } return result; } }
ListUtils { public static <E> List<E> subtract(final List<E> list1, final List<? extends E> list2) { final ArrayList<E> result = new ArrayList<E>(); final HashBag<E> bag = new HashBag<E>(list2); for (final E e : list1) { if (!bag.remove(e, 1)) { result.add(e); } } return result; } private ListUtils(); }
ListUtils { public static <E> List<E> subtract(final List<E> list1, final List<? extends E> list2) { final ArrayList<E> result = new ArrayList<E>(); final HashBag<E> bag = new HashBag<E>(list2); for (final E e : list1) { if (!bag.remove(e, 1)) { result.add(e); } } return result; } private ListUtils(); static List<T> e...
ListUtils { public static <E> List<E> subtract(final List<E> list1, final List<? extends E> list2) { final ArrayList<E> result = new ArrayList<E>(); final HashBag<E> bag = new HashBag<E>(list2); for (final E e : list1) { if (!bag.remove(e, 1)) { result.add(e); } } return result; } private ListUtils(); static List<T> e...
@Test public void testSubtractNullElement() { final List<String> list = new ArrayList<String>(); list.add(a); list.add(null); list.add(null); list.add(x); final List<String> sub = new ArrayList<String>(); sub.add(null); final List<String> result = ListUtils.subtract(list, sub); assertTrue(result.size() == 3); final Lis...
public static <E> List<E> subtract(final List<E> list1, final List<? extends E> list2) { final ArrayList<E> result = new ArrayList<E>(); final HashBag<E> bag = new HashBag<E>(list2); for (final E e : list1) { if (!bag.remove(e, 1)) { result.add(e); } } return result; }
ListUtils { public static <E> List<E> subtract(final List<E> list1, final List<? extends E> list2) { final ArrayList<E> result = new ArrayList<E>(); final HashBag<E> bag = new HashBag<E>(list2); for (final E e : list1) { if (!bag.remove(e, 1)) { result.add(e); } } return result; } }
ListUtils { public static <E> List<E> subtract(final List<E> list1, final List<? extends E> list2) { final ArrayList<E> result = new ArrayList<E>(); final HashBag<E> bag = new HashBag<E>(list2); for (final E e : list1) { if (!bag.remove(e, 1)) { result.add(e); } } return result; } private ListUtils(); }
ListUtils { public static <E> List<E> subtract(final List<E> list1, final List<? extends E> list2) { final ArrayList<E> result = new ArrayList<E>(); final HashBag<E> bag = new HashBag<E>(list2); for (final E e : list1) { if (!bag.remove(e, 1)) { result.add(e); } } return result; } private ListUtils(); static List<T> e...
ListUtils { public static <E> List<E> subtract(final List<E> list1, final List<? extends E> list2) { final ArrayList<E> result = new ArrayList<E>(); final HashBag<E> bag = new HashBag<E>(list2); for (final E e : list1) { if (!bag.remove(e, 1)) { result.add(e); } } return result; } private ListUtils(); static List<T> e...
@Test public void testIndexOf() { Predicate<String> testPredicate = EqualPredicate.equalPredicate("d"); int index = ListUtils.indexOf(fullList, testPredicate); assertEquals(d, fullList.get(index)); testPredicate = EqualPredicate.equalPredicate("de"); index = ListUtils.indexOf(fullList, testPredicate); assertEquals(inde...
public static <E> int indexOf(final List<E> list, final Predicate<E> predicate) { if (list != null && predicate != null) { for (int i = 0; i < list.size(); i++) { final E item = list.get(i); if (predicate.evaluate(item)) { return i; } } } return -1; }
ListUtils { public static <E> int indexOf(final List<E> list, final Predicate<E> predicate) { if (list != null && predicate != null) { for (int i = 0; i < list.size(); i++) { final E item = list.get(i); if (predicate.evaluate(item)) { return i; } } } return -1; } }
ListUtils { public static <E> int indexOf(final List<E> list, final Predicate<E> predicate) { if (list != null && predicate != null) { for (int i = 0; i < list.size(); i++) { final E item = list.get(i); if (predicate.evaluate(item)) { return i; } } } return -1; } private ListUtils(); }
ListUtils { public static <E> int indexOf(final List<E> list, final Predicate<E> predicate) { if (list != null && predicate != null) { for (int i = 0; i < list.size(); i++) { final E item = list.get(i); if (predicate.evaluate(item)) { return i; } } } return -1; } private ListUtils(); static List<T> emptyIfNull(final L...
ListUtils { public static <E> int indexOf(final List<E> list, final Predicate<E> predicate) { if (list != null && predicate != null) { for (int i = 0; i < list.size(); i++) { final E item = list.get(i); if (predicate.evaluate(item)) { return i; } } } return -1; } private ListUtils(); static List<T> emptyIfNull(final L...
@Test @SuppressWarnings("boxing") public void testLongestCommonSubsequence() { try { ListUtils.longestCommonSubsequence((List<?>) null, null); fail("failed to check for null argument"); } catch (final NullPointerException e) {} try { ListUtils.longestCommonSubsequence(Arrays.asList('A'), null); fail("failed to check fo...
public static <E> List<E> longestCommonSubsequence(final List<E> a, final List<E> b) { return longestCommonSubsequence( a, b, DefaultEquator.defaultEquator() ); }
ListUtils { public static <E> List<E> longestCommonSubsequence(final List<E> a, final List<E> b) { return longestCommonSubsequence( a, b, DefaultEquator.defaultEquator() ); } }
ListUtils { public static <E> List<E> longestCommonSubsequence(final List<E> a, final List<E> b) { return longestCommonSubsequence( a, b, DefaultEquator.defaultEquator() ); } private ListUtils(); }
ListUtils { public static <E> List<E> longestCommonSubsequence(final List<E> a, final List<E> b) { return longestCommonSubsequence( a, b, DefaultEquator.defaultEquator() ); } private ListUtils(); static List<T> emptyIfNull(final List<T> list); static List<T> defaultIfNull(final List<T> list, final List<T> defaultList)...
ListUtils { public static <E> List<E> longestCommonSubsequence(final List<E> a, final List<E> b) { return longestCommonSubsequence( a, b, DefaultEquator.defaultEquator() ); } private ListUtils(); static List<T> emptyIfNull(final List<T> list); static List<T> defaultIfNull(final List<T> list, final List<T> defaultList)...
@Test public void testLongestCommonSubsequenceWithString() { try { ListUtils.longestCommonSubsequence((String) null, null); fail("failed to check for null argument"); } catch (final NullPointerException e) {} try { ListUtils.longestCommonSubsequence("A", null); fail("failed to check for null argument"); } catch (final ...
public static <E> List<E> longestCommonSubsequence(final List<E> a, final List<E> b) { return longestCommonSubsequence( a, b, DefaultEquator.defaultEquator() ); }
ListUtils { public static <E> List<E> longestCommonSubsequence(final List<E> a, final List<E> b) { return longestCommonSubsequence( a, b, DefaultEquator.defaultEquator() ); } }
ListUtils { public static <E> List<E> longestCommonSubsequence(final List<E> a, final List<E> b) { return longestCommonSubsequence( a, b, DefaultEquator.defaultEquator() ); } private ListUtils(); }
ListUtils { public static <E> List<E> longestCommonSubsequence(final List<E> a, final List<E> b) { return longestCommonSubsequence( a, b, DefaultEquator.defaultEquator() ); } private ListUtils(); static List<T> emptyIfNull(final List<T> list); static List<T> defaultIfNull(final List<T> list, final List<T> defaultList)...
ListUtils { public static <E> List<E> longestCommonSubsequence(final List<E> a, final List<E> b) { return longestCommonSubsequence( a, b, DefaultEquator.defaultEquator() ); } private ListUtils(); static List<T> emptyIfNull(final List<T> list); static List<T> defaultIfNull(final List<T> list, final List<T> defaultList)...
@Test @SuppressWarnings("boxing") public void testPartition() { final List<Integer> strings = new ArrayList<Integer>(); for (int i = 0; i <= 6; i++) { strings.add(i); } final List<List<Integer>> partition = ListUtils.partition(strings, 3); assertNotNull(partition); assertEquals(3, partition.size()); assertEquals(1, par...
public static <T> List<List<T>> partition(final List<T> list, final int size) { if (list == null) { throw new NullPointerException("List must not be null"); } if (size <= 0) { throw new IllegalArgumentException("Size must be greater than 0"); } return new Partition<T>(list, size); }
ListUtils { public static <T> List<List<T>> partition(final List<T> list, final int size) { if (list == null) { throw new NullPointerException("List must not be null"); } if (size <= 0) { throw new IllegalArgumentException("Size must be greater than 0"); } return new Partition<T>(list, size); } }
ListUtils { public static <T> List<List<T>> partition(final List<T> list, final int size) { if (list == null) { throw new NullPointerException("List must not be null"); } if (size <= 0) { throw new IllegalArgumentException("Size must be greater than 0"); } return new Partition<T>(list, size); } private ListUtils(); }
ListUtils { public static <T> List<List<T>> partition(final List<T> list, final int size) { if (list == null) { throw new NullPointerException("List must not be null"); } if (size <= 0) { throw new IllegalArgumentException("Size must be greater than 0"); } return new Partition<T>(list, size); } private ListUtils(); st...
ListUtils { public static <T> List<List<T>> partition(final List<T> list, final int size) { if (list == null) { throw new NullPointerException("List must not be null"); } if (size <= 0) { throw new IllegalArgumentException("Size must be greater than 0"); } return new Partition<T>(list, size); } private ListUtils(); st...
@Test @SuppressWarnings("boxing") public void testSelect() { final List<Integer> list = new ArrayList<Integer>(); list.add(1); list.add(2); list.add(3); list.add(4); final List<Integer> output1 = ListUtils.select(list, EQUALS_TWO); final List<Number> output2 = ListUtils.<Number>select(list, EQUALS_TWO); final HashSet<N...
public static <E> List<E> select(final Collection<? extends E> inputCollection, final Predicate<? super E> predicate) { return CollectionUtils.select(inputCollection, predicate, new ArrayList<E>(inputCollection.size())); }
ListUtils { public static <E> List<E> select(final Collection<? extends E> inputCollection, final Predicate<? super E> predicate) { return CollectionUtils.select(inputCollection, predicate, new ArrayList<E>(inputCollection.size())); } }
ListUtils { public static <E> List<E> select(final Collection<? extends E> inputCollection, final Predicate<? super E> predicate) { return CollectionUtils.select(inputCollection, predicate, new ArrayList<E>(inputCollection.size())); } private ListUtils(); }
ListUtils { public static <E> List<E> select(final Collection<? extends E> inputCollection, final Predicate<? super E> predicate) { return CollectionUtils.select(inputCollection, predicate, new ArrayList<E>(inputCollection.size())); } private ListUtils(); static List<T> emptyIfNull(final List<T> list); static List<T> ...
ListUtils { public static <E> List<E> select(final Collection<? extends E> inputCollection, final Predicate<? super E> predicate) { return CollectionUtils.select(inputCollection, predicate, new ArrayList<E>(inputCollection.size())); } private ListUtils(); static List<T> emptyIfNull(final List<T> list); static List<T> ...
@Test public void testUpdate() throws Exception { TypeToken<User> pt = TypeToken.of(User.class); TypeToken<Integer> rt = TypeToken.of(int.class); String srcSql = "update user set name=:1.name where id=:1.id"; AbstractOperator operator = getOperator(pt, rt, srcSql); operator.setJdbcOperations(new JdbcOperationsAdapter()...
@Override public Object execute(Object[] values, InvocationStat stat) { InvocationContext context = invocationContextFactory.newInvocationContext(values); return execute(context, stat); }
UpdateOperator extends AbstractOperator { @Override public Object execute(Object[] values, InvocationStat stat) { InvocationContext context = invocationContextFactory.newInvocationContext(values); return execute(context, stat); } }
UpdateOperator extends AbstractOperator { @Override public Object execute(Object[] values, InvocationStat stat) { InvocationContext context = invocationContextFactory.newInvocationContext(values); return execute(context, stat); } UpdateOperator(ASTRootNode rootNode, MethodDescriptor md, Config config); }
UpdateOperator extends AbstractOperator { @Override public Object execute(Object[] values, InvocationStat stat) { InvocationContext context = invocationContextFactory.newInvocationContext(values); return execute(context, stat); } UpdateOperator(ASTRootNode rootNode, MethodDescriptor md, Config config); @Override Object...
UpdateOperator extends AbstractOperator { @Override public Object execute(Object[] values, InvocationStat stat) { InvocationContext context = invocationContextFactory.newInvocationContext(values); return execute(context, stat); } UpdateOperator(ASTRootNode rootNode, MethodDescriptor md, Config config); @Override Object...
@Test public void testResolveType() throws Exception { TypeToken<HashMap<String, Integer>> mapToken = new TypeToken<HashMap<String, Integer>>() { }; TypeToken<?> entrySetToken = mapToken.resolveType(Map.class.getMethod("entrySet").getGenericReturnType()); assertThat(entrySetToken.toString(), equalTo("java.util.Set<java...
public final TypeToken<?> resolveType(Type type) { TypeResolver resolver = typeResolver; if (resolver == null) { resolver = (typeResolver = TypeResolver.accordingTo(runtimeType)); } return of(resolver.resolveType(type)); }
TypeToken extends TypeCapture<T> implements Serializable { public final TypeToken<?> resolveType(Type type) { TypeResolver resolver = typeResolver; if (resolver == null) { resolver = (typeResolver = TypeResolver.accordingTo(runtimeType)); } return of(resolver.resolveType(type)); } }
TypeToken extends TypeCapture<T> implements Serializable { public final TypeToken<?> resolveType(Type type) { TypeResolver resolver = typeResolver; if (resolver == null) { resolver = (typeResolver = TypeResolver.accordingTo(runtimeType)); } return of(resolver.resolveType(type)); } protected TypeToken(); private TypeT...
TypeToken extends TypeCapture<T> implements Serializable { public final TypeToken<?> resolveType(Type type) { TypeResolver resolver = typeResolver; if (resolver == null) { resolver = (typeResolver = TypeResolver.accordingTo(runtimeType)); } return of(resolver.resolveType(type)); } protected TypeToken(); private TypeT...
TypeToken extends TypeCapture<T> implements Serializable { public final TypeToken<?> resolveType(Type type) { TypeResolver resolver = typeResolver; if (resolver == null) { resolver = (typeResolver = TypeResolver.accordingTo(runtimeType)); } return of(resolver.resolveType(type)); } protected TypeToken(); private TypeT...
@Test @SuppressWarnings("boxing") public void testSelectRejected() { final List<Long> list = new ArrayList<Long>(); list.add(1L); list.add(2L); list.add(3L); list.add(4L); final List<Long> output1 = ListUtils.selectRejected(list, EQUALS_TWO); final List<? extends Number> output2 = ListUtils.selectRejected(list, EQUALS_...
public static <E> List<E> selectRejected(final Collection<? extends E> inputCollection, final Predicate<? super E> predicate) { return CollectionUtils.selectRejected(inputCollection, predicate, new ArrayList<E>(inputCollection.size())); }
ListUtils { public static <E> List<E> selectRejected(final Collection<? extends E> inputCollection, final Predicate<? super E> predicate) { return CollectionUtils.selectRejected(inputCollection, predicate, new ArrayList<E>(inputCollection.size())); } }
ListUtils { public static <E> List<E> selectRejected(final Collection<? extends E> inputCollection, final Predicate<? super E> predicate) { return CollectionUtils.selectRejected(inputCollection, predicate, new ArrayList<E>(inputCollection.size())); } private ListUtils(); }
ListUtils { public static <E> List<E> selectRejected(final Collection<? extends E> inputCollection, final Predicate<? super E> predicate) { return CollectionUtils.selectRejected(inputCollection, predicate, new ArrayList<E>(inputCollection.size())); } private ListUtils(); static List<T> emptyIfNull(final List<T> list);...
ListUtils { public static <E> List<E> selectRejected(final Collection<? extends E> inputCollection, final Predicate<? super E> predicate) { return CollectionUtils.selectRejected(inputCollection, predicate, new ArrayList<E>(inputCollection.size())); } private ListUtils(); static List<T> emptyIfNull(final List<T> list);...
@Test @SuppressWarnings({ "unchecked", "rawtypes" }) public void testEmptyUnmodifiableMultiValuedMap() { final MultiValuedMap map = MultiMapUtils.EMPTY_MULTI_VALUED_MAP; assertTrue(map.isEmpty()); try { map.put("key", "value"); fail("Should throw UnsupportedOperationException"); } catch (UnsupportedOperationException e...
public static boolean isEmpty(final MultiValuedMap<?, ?> map) { return map == null || map.isEmpty(); }
MultiMapUtils { public static boolean isEmpty(final MultiValuedMap<?, ?> map) { return map == null || map.isEmpty(); } }
MultiMapUtils { public static boolean isEmpty(final MultiValuedMap<?, ?> map) { return map == null || map.isEmpty(); } private MultiMapUtils(); }
MultiMapUtils { public static boolean isEmpty(final MultiValuedMap<?, ?> map) { return map == null || map.isEmpty(); } private MultiMapUtils(); @SuppressWarnings("unchecked") static MultiValuedMap<K, V> emptyMultiValuedMap(); @SuppressWarnings("unchecked") static MultiValuedMap<K, V> emptyIfNull(final MultiValuedMap<K...
MultiMapUtils { public static boolean isEmpty(final MultiValuedMap<?, ?> map) { return map == null || map.isEmpty(); } private MultiMapUtils(); @SuppressWarnings("unchecked") static MultiValuedMap<K, V> emptyMultiValuedMap(); @SuppressWarnings("unchecked") static MultiValuedMap<K, V> emptyIfNull(final MultiValuedMap<K...
@Test public void testEmptyIfNull() { assertTrue(MultiMapUtils.emptyIfNull(null).isEmpty()); final MultiValuedMap<String, String> map = new ArrayListValuedHashMap<String, String>(); map.put("item", "value"); assertFalse(MultiMapUtils.emptyIfNull(map).isEmpty()); }
@SuppressWarnings("unchecked") public static <K, V> MultiValuedMap<K, V> emptyIfNull(final MultiValuedMap<K, V> map) { return map == null ? EMPTY_MULTI_VALUED_MAP : map; }
MultiMapUtils { @SuppressWarnings("unchecked") public static <K, V> MultiValuedMap<K, V> emptyIfNull(final MultiValuedMap<K, V> map) { return map == null ? EMPTY_MULTI_VALUED_MAP : map; } }
MultiMapUtils { @SuppressWarnings("unchecked") public static <K, V> MultiValuedMap<K, V> emptyIfNull(final MultiValuedMap<K, V> map) { return map == null ? EMPTY_MULTI_VALUED_MAP : map; } private MultiMapUtils(); }
MultiMapUtils { @SuppressWarnings("unchecked") public static <K, V> MultiValuedMap<K, V> emptyIfNull(final MultiValuedMap<K, V> map) { return map == null ? EMPTY_MULTI_VALUED_MAP : map; } private MultiMapUtils(); @SuppressWarnings("unchecked") static MultiValuedMap<K, V> emptyMultiValuedMap(); @SuppressWarnings("unche...
MultiMapUtils { @SuppressWarnings("unchecked") public static <K, V> MultiValuedMap<K, V> emptyIfNull(final MultiValuedMap<K, V> map) { return map == null ? EMPTY_MULTI_VALUED_MAP : map; } private MultiMapUtils(); @SuppressWarnings("unchecked") static MultiValuedMap<K, V> emptyMultiValuedMap(); @SuppressWarnings("unche...
@Test public void testIsEmptyWithEmptyMap() { final MultiValuedMap<Object, Object> map = new ArrayListValuedHashMap<Object, Object>(); assertEquals(true, MultiMapUtils.isEmpty(map)); }
public static boolean isEmpty(final MultiValuedMap<?, ?> map) { return map == null || map.isEmpty(); }
MultiMapUtils { public static boolean isEmpty(final MultiValuedMap<?, ?> map) { return map == null || map.isEmpty(); } }
MultiMapUtils { public static boolean isEmpty(final MultiValuedMap<?, ?> map) { return map == null || map.isEmpty(); } private MultiMapUtils(); }
MultiMapUtils { public static boolean isEmpty(final MultiValuedMap<?, ?> map) { return map == null || map.isEmpty(); } private MultiMapUtils(); @SuppressWarnings("unchecked") static MultiValuedMap<K, V> emptyMultiValuedMap(); @SuppressWarnings("unchecked") static MultiValuedMap<K, V> emptyIfNull(final MultiValuedMap<K...
MultiMapUtils { public static boolean isEmpty(final MultiValuedMap<?, ?> map) { return map == null || map.isEmpty(); } private MultiMapUtils(); @SuppressWarnings("unchecked") static MultiValuedMap<K, V> emptyMultiValuedMap(); @SuppressWarnings("unchecked") static MultiValuedMap<K, V> emptyIfNull(final MultiValuedMap<K...