Collection class that doesn’t allow null elements?

Use Constraints: import com.google.common.collect.Constraints; … Constraints.constrainedList(new ArrayList(), Constraints.notNull()) from Guava for maximum flexibility. UPDATE: Guava Constraints has been deprecated in Release 15 – apparently without replacement. UPDATE 2: As of now (Guava 19.0-rc2) Constrains is still there and not deprecated anymore. However, it’s missing from the Javadoc. I’m afraid that the Javadoc is right as … Read more

Eclipse bug? Switching on a null with only default case

This is a bug. Here’s the specified behavior for a switch statement according to the Java Language Specification, 3rd Edition: JLS 14.11 The switch Statement SwitchStatement: switch ( Expression ) SwitchBlock When the switch statement is executed, first the Expression is evaluated. If the Expression evaluates to null, a NullPointerException is thrown and the entire … Read more

Oracle SQL – max() with NULL values

max(end_dt) keep (dense_rank first order by end_dt desc nulls first) upd: SQL Fiddle Oracle 11g R2 Schema Setup: CREATE TABLE t (val int, s date, e date) ; INSERT ALL INTO t (val, s, e) VALUES (1, sysdate-3, sysdate-2) INTO t (val, s, e) VALUES (1, sysdate-2, sysdate-1) INTO t (val, s, e) VALUES (1, … Read more

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