Nov. 18th, 2008

juan_gandhi: (Default)
enum E {
  E1, E2, E3
};

void <X extends Enum<X>> scanme(X anEnum) {
  for (X x : anEnum) {
    System.out.println(" - " + x);
  }
}

...
  scanme(E);


Guess what's wrong with this code! :)
juan_gandhi: (Default)
Problem: you are given an interface Function<X, Y> { Y apply(X x); }, write a method that takes an instance of Y and returns a constant function always returning this instance of Y.

public Function<X, Y> apply(Object<X> p) {
  Function<Y> y = new Function<Y>() {
    public <Y> apply(Object<X> p) {
      Object<Y> y = new Object<Y>();
      return y;
    }
  }
  return y;
}

(lead developer from a certain company starting with 'y')
juan_gandhi: (Default)
Например, что строительство коммунизма приводит почему-то к феодализму. Даже в таких небольших структурах типа большой хорошей компании.

Но это не худший ещё вариант - сегодня ж как раз тридцать лет Джонстауну...

Нет, я не про это.

Всех прошу посмотреть фильм "10 items or less". Очень.

Profile

juan_gandhi: (Default)
Juan-Carlos Gandhi

September 2025

S M T W T F S
 1 2345 6
78 9 10 111213
14151617181920
21222324252627
282930    

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Sep. 12th, 2025 04:01 pm
Powered by Dreamwidth Studios