If current name is appearing for the first time
if ( ! set . contains ( arr [ i ] ) ) { System . out . print ( "NoNEW_LINE"); set . add ( arr [ i ] ) ; } else { System . out . print ( "YesNEW_LINE"); } } }