This interface is used to represent a group of principals. (A principal represents an entity such as an individual user or a company).
Note that Group extends Principal. Thus, either a Principal or a Group can be passed as an argument to methods containing a Principal parameter. For example, you can add either a Principal or a Group to a Group object by calling the object's addMember method, passing it the Principal or Group.
Returns true if the passed principal is a member of the group. This method does a recursive search, so if a principal belongs to a group which is a member of this group, true is returned.
Parameters
member
Principal!: the principal whose membership is to be checked.
Returns an enumeration of the members in the group. The returned objects can be instances of either Principal or Group (which is a subclass of Principal).
true if the principal was removed, or false if the principal was not a member.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# Group\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \nDeprecated in [API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nGroup\n=====\n\n```\ninterface Group : Principal\n```\n\n|------------------------------|\n| [java.security.acl.Group](#) |\n\n*** ** * ** ***\n\n| **This interface was deprecated in API level 33.**\n|\n| This class is deprecated and subject to removal in a future version of Java SE. It has been replaced by `java.security.Policy` and related classes since 1.2.\n\nThis interface is used to represent a group of principals. (A principal represents an entity such as an individual user or a company).\n\nNote that Group extends Principal. Thus, either a Principal or a Group can be passed as an argument to methods containing a Principal parameter. For example, you can add either a Principal or a Group to a Group object by calling the object's `addMember` method, passing it the Principal or Group.\n\nSummary\n-------\n\n| Public methods ||\n|-----------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [addMember](#addMember(java.security.Principal))`(`user:` `[Principal](../Principal.html#)!`)` Adds the specified member to the group. |\n| abstract [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [isMember](#isMember(java.security.Principal))`(`member:` `[Principal](../Principal.html#)!`)` Returns true if the passed principal is a member of the group. |\n| abstract [Enumeration](../../util/Enumeration.html#)\\\u003cout [Principal](../Principal.html#)!\\\u003e! | [members](#members())`()` Returns an enumeration of the members in the group. |\n| abstract [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [removeMember](#removeMember(java.security.Principal))`(`user:` `[Principal](../Principal.html#)!`)` Removes the specified member from the group. |\n\n| Inherited functions ||\n|---|---|\n| From class [Principal](../Principal.html#) |------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)! | [getName](../Principal.html#getName())`()` Returns the name of this principal. \u003cbr /\u003e | | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [implies](../Principal.html#implies(javax.security.auth.Subject))`(`subject:` `[Subject](../../../javax/security/auth/Subject.html#)!`)` Returns true if the specified subject is implied by this principal. \u003cbr /\u003e | ||\n\nPublic methods\n--------------\n\n### addMember\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun addMember(user: Principal!): Boolean\n```\n\n**Deprecated:** *Deprecated in Java.*\n\nAdds the specified member to the group.\n\n| Parameters ||\n|--------|-----------------------------------------------------------------------|\n| `user` | [Principal](../Principal.html#)!: the principal to add to this group. |\n\n| Return ||\n|------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------|\n| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | true if the member was successfully added, false if the principal was already a member. |\n\n### isMember\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun isMember(member: Principal!): Boolean\n```\n\n**Deprecated:** *Deprecated in Java.*\n\nReturns true if the passed principal is a member of the group. This method does a recursive search, so if a principal belongs to a group which is a member of this group, true is returned.\n\n| Parameters ||\n|----------|------------------------------------------------------------------------------------|\n| `member` | [Principal](../Principal.html#)!: the principal whose membership is to be checked. |\n\n| Return ||\n|------------------------------------------------------------------------------------|-------------------------------------------------------------------|\n| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | true if the principal is a member of this group, false otherwise. |\n\n### members\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun members(): Enumeration\u003cout Principal!\u003e!\n```\n\n**Deprecated:** *Deprecated in Java.*\n\nReturns an enumeration of the members in the group. The returned objects can be instances of either Principal or Group (which is a subclass of Principal).\n\n| Return ||\n|--------------------------------------------------------------------------------------|--------------------------------------|\n| [Enumeration](../../util/Enumeration.html#)\u003cout` `[Principal](../Principal.html#)!\u003e! | an enumeration of the group members. |\n\n### removeMember\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun removeMember(user: Principal!): Boolean\n```\n\n**Deprecated:** *Deprecated in Java.*\n\nRemoves the specified member from the group.\n\n| Parameters ||\n|--------|----------------------------------------------------------------------------|\n| `user` | [Principal](../Principal.html#)!: the principal to remove from this group. |\n\n| Return ||\n|------------------------------------------------------------------------------------|--------------------------------------------------------------------------------|\n| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | true if the principal was removed, or false if the principal was not a member. |"]]