driver-core/src/main/com/mongodb/internal/operation/IndexHelper.java
public static List<String> getIndexNames(final List<IndexModel> indexes, final CodecRegistry codecRegistry) {
        List<String> indexNames = new ArrayList<String>(indexes.size());
        for (IndexModel index : indexes) {
            String name = index.getOptions().getName();
            if (name != null) {
                indexNames.add(name);
            } else {
                indexNames.add(IndexHelper.generateIndexName(index.getKeys().toBsonDocument(BsonDocument.class, codecRegistry)));
            }
        }
        return indexNames;
    }
public static List<String> getIndexNames(final List<IndexModel> indexes, final CodecRegistry codecRegistry) {
        List<String> indexNames = new ArrayList<String>(indexes.size());
        for (IndexModel index : indexes) {
            String name = index.getOptions().getName();
            if (name != null) {
                indexNames.add(name);
            } else {
                indexNames.add(IndexHelper.generateIndexName(index.getKeys().toBsonDocument(BsonDocument.class, codecRegistry)));
            }
        }
        return indexNames;
    }
public static List < String > getIndexNames ( final List < IndexModel > indexes , final CodecRegistry codecRegistry ) { List < String > indexNames = new ArrayList < String > ( indexes . size ( ) ) ; for ( IndexModel index : indexes ) { String name = index . getOptions ( ) . getName ( ) ; if ( name != null ) { indexNames . add ( name ) ; } else { indexNames . add ( IndexHelper . generateIndexName ( index . getKeys ( ) . toBsonDocument ( BsonDocument . class , codecRegistry ) ) ) ; } } return indexNames ; }
Get a list of index names for the given list of index models

@param indexes the index models
@param codecRegistry the codec registry to convert each Bson key to a BsonDocument
@return the list of index names
Get a list of index names for the given list of index models