hollow/src/main/java/com/netflix/hollow/core/memory/ThreadSafeBitSet.java
public static ThreadSafeBitSet orAll(ThreadSafeBitSet... bitSets) {
        if(bitSets.length == 0)
            return new ThreadSafeBitSet();

        int log2SegmentSize = bitSets[0].log2SegmentSize;
        int numLongsPerSegment = bitSets[0].numLongsPerSegment;

        ThreadSafeBitSetSegments segments[] = new ThreadSafeBitSetSegments[bitSets.length];
        int maxNumSegments = 0;

        for(int i=0;i<bitSets.length;i++) {
            if(bitSets[i].log2SegmentSize != log2SegmentSize)
                throw new IllegalArgumentException("Segment sizes must be the same");

            segments[i] = bitSets[i].segments.get();
            if(segments[i].numSegments() > maxNumSegments)
                maxNumSegments = segments[i].numSegments();
        }

        ThreadSafeBitSetSegments newSegments = new ThreadSafeBitSetSegments(maxNumSegments, numLongsPerSegment);

        AtomicLongArray segment[] = new AtomicLongArray[segments.length];

        for(int i=0;i<maxNumSegments;i++) {
            for(int j=0;j<segments.length;j++) {
                segment[j] = i < segments[j].numSegments() ? segments[j].getSegment(i) : null;
            }

            AtomicLongArray newSegment = newSegments.getSegment(i);

            for(int j=0;j<numLongsPerSegment;j++) {
                long value = 0;
                for(int k=0;k<segments.length;k++) {
                    if(segment[k] != null)
                        value |= segment[k].get(j);
                }
                newSegment.set(j, value);
            }
        }

        ThreadSafeBitSet or = new ThreadSafeBitSet(log2SegmentSize);
        or.segments.set(newSegments);
        return or;
    }
public static ThreadSafeBitSet orAll(ThreadSafeBitSet... bitSets) {
        if(bitSets.length == 0)
            return new ThreadSafeBitSet();

        int log2SegmentSize = bitSets[0].log2SegmentSize;
        int numLongsPerSegment = bitSets[0].numLongsPerSegment;

        ThreadSafeBitSetSegments segments[] = new ThreadSafeBitSetSegments[bitSets.length];
        int maxNumSegments = 0;

        for(int i=0;i<bitSets.length;i++) {
            if(bitSets[i].log2SegmentSize != log2SegmentSize)
                throw new IllegalArgumentException("Segment sizes must be the same");

            segments[i] = bitSets[i].segments.get();
            if(segments[i].numSegments() > maxNumSegments)
                maxNumSegments = segments[i].numSegments();
        }

        ThreadSafeBitSetSegments newSegments = new ThreadSafeBitSetSegments(maxNumSegments, numLongsPerSegment);

        AtomicLongArray segment[] = new AtomicLongArray[segments.length];

        for(int i=0;i<maxNumSegments;i++) {
            for(int j=0;j<segments.length;j++) {
                segment[j] = i < segments[j].numSegments() ? segments[j].getSegment(i) : null;
            }

            AtomicLongArray newSegment = newSegments.getSegment(i);

            for(int j=0;j<numLongsPerSegment;j++) {
                long value = 0;
                for(int k=0;k<segments.length;k++) {
                    if(segment[k] != null)
                        value |= segment[k].get(j);
                }
                newSegment.set(j, value);
            }
        }

        ThreadSafeBitSet or = new ThreadSafeBitSet(log2SegmentSize);
        or.segments.set(newSegments);
        return or;
    }
public static ThreadSafeBitSet orAll ( ThreadSafeBitSet ... bitSets ) { if ( bitSets . length == 0 ) return new ThreadSafeBitSet ( ) ; int log2SegmentSize = bitSets [ 0 ] . log2SegmentSize ; int numLongsPerSegment = bitSets [ 0 ] . numLongsPerSegment ; ThreadSafeBitSetSegments segments [ ] = new ThreadSafeBitSetSegments [ bitSets . length ] ; int maxNumSegments = 0 ; for ( int i = 0 ; i < bitSets . length ; i ++ ) { if ( bitSets [ i ] . log2SegmentSize != log2SegmentSize ) throw new IllegalArgumentException ( "Segment sizes must be the same" ) ; segments [ i ] = bitSets [ i ] . segments . get ( ) ; if ( segments [ i ] . numSegments ( ) > maxNumSegments ) maxNumSegments = segments [ i ] . numSegments ( ) ; } ThreadSafeBitSetSegments newSegments = new ThreadSafeBitSetSegments ( maxNumSegments , numLongsPerSegment ) ; AtomicLongArray segment [ ] = new AtomicLongArray [ segments . length ] ; for ( int i = 0 ; i < maxNumSegments ; i ++ ) { for ( int j = 0 ; j < segments . length ; j ++ ) { segment [ j ] = i < segments [ j ] . numSegments ( ) ? segments [ j ] . getSegment ( i ) : null ; } AtomicLongArray newSegment = newSegments . getSegment ( i ) ; for ( int j = 0 ; j < numLongsPerSegment ; j ++ ) { long value = 0 ; for ( int k = 0 ; k < segments . length ; k ++ ) { if ( segment [ k ] != null ) value |= segment [ k ] . get ( j ) ; } newSegment . set ( j , value ) ; } } ThreadSafeBitSet or = new ThreadSafeBitSet ( log2SegmentSize ) ; or . segments . set ( newSegments ) ; return or ; }
Return a new bit set which contains all bits which are contained in *any* of the specified bit sets.

@param bitSets the other bit sets
@return the resulting bit set
Return a new bit set which contains all bits which are contained in * any * of the specified bit sets .