static boolean hasClashOnLowerTraceId ( List < List < Span > > input ) { int traceCount = input . size ( ) ; if ( traceCount <= 1 ) return false ; // NOTE: It is probably more efficient to do clever sorting and peeking here, but the call site // is query side, which is not in the critical path of user code. A set is much easier to grok. Set < String > traceIdLows = new LinkedHashSet <> ( ) ; boolean clash = false ; for ( int i = 0 ; i < traceCount ; i ++ ) { String traceId = lowerTraceId ( input . get ( i ) . get ( 0 ) . traceId ( ) ) ; if ( ! traceIdLows . add ( traceId ) ) { clash = true ; break ; } } return clash ; }
necessary is also more efficient .