question: public static void writeListOfLongs ( List list , boolean hasLongIDs , DataOutput out ) throws IOException { if ( list == null ) { out . writeInt ( - 1 ) ; } else { out . writeInt ( list . size ( ) ) ; out . writeBoolean ( hasLongIDs ) ; for ( Iterator it = list . iterator ( ) ; it . hasNext ( ) ; ) { Long l = ( Long ) it . next ( ) ; if ( hasLongIDs ) { out . writeLong ( l . longValue ( ) ) ; } else { out . writeInt ( ( int ) l . longValue ( ) ) ; } } } }
target:  write a set of Long objects