public ConsumerGroupMember getOrMaybeCreateMember(
        String memberId,
        boolean createIfNotExists
    ) {
        ConsumerGroupMember member = members.get(memberId);
        if (member != null) return member;

        if (!createIfNotExists) {
            throw new UnknownMemberIdException(
                String.format("Member %s is not a member of group %s.", memberId, groupId)
            );
        }

        return new ConsumerGroupMember.Builder(memberId).build();
    }
Gets or creates a new member but without adding it to the group. Adding a member
is done via the {@link ConsumerGroup#updateMember(ConsumerGroupMember)} method.

@param memberId          The member id.
@param createIfNotExists Booleans indicating whether the member must be
                         created if it does not exist.

@return A ConsumerGroupMember.
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/modern/consumer/ConsumerGroup.java