public static ListenerInfo create(
        Optional<String> firstListenerName,
        List<Endpoint> rawListeners
    ) {
        LinkedHashMap<String, Endpoint> listeners = new LinkedHashMap<>();
        for (Endpoint listener : rawListeners) {
            String name = listener.listenerName().get();
            if (Optional.of(name).equals(firstListenerName)) {
                listeners.put(name, listener);
                break;
            }
        }
        for (Endpoint listener : rawListeners) {
            String name = listener.listenerName().get();
            if (!Optional.of(name).equals(firstListenerName)) {
                listeners.put(name, listener);
            }
        }
        return new ListenerInfo(listeners);
    }
Create a ListenerInfo from data in a RegisterBrokerRecord.

@param collection    The record data.

@return              The ListenerInfo object.
metadata/src/main/java/org/apache/kafka/metadata/ListenerInfo.java