I need your opinion... (original) (raw)
Marek Kozieł develop4lasu at gmail.com
Fri Mar 27 21:29:09 PDT 2009
- Previous message: I need your opinion...
- Next message: I need your opinion...
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
5.while-each (same as for-each but ONLY for Iterator-s) void f( Iterator<List> sheet , boolean containsTitle) if ( ! iterator.hasNext() ) return; ArrayList title = ( containsTitle ? iterator.next() : null ); while (ArrayList row : iterator){ ... } ... }
while-each & final: void f( Iterator<List> sheet , boolean containsTitle) if ( ! iterator.hasNext() ) return; final title = ( containsTitle ? iterator.next() : null ); while (final row : iterator){ ... } ... }
Normal 1: void f(List<List> sheet, boolean containsTitle) if ( sheet.size==0 ) return; ArrayList title = ( containsTitle ? sheet.get(0) : null ); boolean ignore = containsTitle; for(ArrayList row : sheet) if (ignore){ ignore = false; continue; } ... } ... }
Normal 2: void f(List<List> sheet, boolean containsTitle) if ( sheet.size==0 ) return; ArrayList title = ( containsTitle ? sheet.get(0) : null ); for(int i =1 ; i< sheet.size(); i++) ArrayList row = sheet.get(i); ... } ... }
Automatic read-write synchronization through lock-s (this need deep analyze) Muli-thread applications are future for sure, this is one of the ways to handle that...
static class Collection{ ReadWriteLock lock =...; synchronized.read(lock) T get(int i){ ... } synchronized.write(lock) boolean add(T newElement){ ... } int addAll(Iterator iterator){ synchronized.write (lock) { .... } } }
final interfaces and abstract classes. make interface final would cause that only specified inheritance would be possible
final interface A allow B,C{}
interface B extends A{}
interface D extends A{} // compile time error
interface E extends B{} // OK, B allow for that
final class C implements A{} // ok
- extends WaekReference-s with query allowing re-use objects
-- Pozdrowionka. / Regards. Lasu aka Marek Kozieł
http://lasu2string.blogspot.com/
- Previous message: I need your opinion...
- Next message: I need your opinion...
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]