Big-O summary for Java Collections Framework implementations? [closed]

The book Java Generics and Collections has this information (pages: 188, 211, 222, 240). List implementations: get add contains next remove(0) iterator.remove ArrayList O(1) O(1) O(n) O(1) O(n) O(n) LinkedList O(n) O(1) O(n) O(1) O(1) O(1) CopyOnWrite-ArrayList O(1) O(n) O(n) O(1) O(n) O(n) Set implementations: add contains next notes HashSet O(1) O(1) O(h/n) h is … Read more

Assert equals between 2 Lists in Junit

For junit4! This question deserves a new answer written for junit5. I realise this answer is written a couple years after the question, probably this feature wasn’t around then. But now, it’s easy to just do this: @Test public void test_array_pass() { List<String> actual = Arrays.asList(“fee”, “fi”, “foe”); List<String> expected = Arrays.asList(“fee”, “fi”, “foe”); assertThat(actual, … Read more

Case-INsensitive Dictionary with string key-type in C#

This seemed related, but I didn’t understand it properly: c# Dictionary: making the Key case-insensitive through declarations It is indeed related. The solution is to tell the dictionary instance not to use the standard string compare method (which is case sensitive) but rather to use a case insensitive one. This is done using the appropriate … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)