public boolean allContainedElementsSameClass() {
        if (!allContainedElementsClassChecked) {
            allContainedElementsClass = null;
            allContainedElementsClassChecked = true;
            boolean hadNull = false;
            for (final S key : this.map.keySet()) {
                if (key == null) {
                    allContainedElementsClass = null;
                    break;
                } else if (allContainedElementsClass != null && !key.getClass().equals(allContainedElementsClass)) {
                    allContainedElementsClass = null;
                    break;
                } else if (allContainedElementsClass == null) {
                    allContainedElementsClass = key.getClass();
                }
            }
        }
        return allContainedElementsClass != null;
    }
@return true if it is guaranteed that all contained elements/objects are of the same type/class and not null (but not
necessarily, i.e., they can have the same type/class, but we may return false here if it was not analysed/identified)
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/process/traversal/step/util/BulkSet.java