日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 编程语言 > java >内容正文

java

java 方法 示例_带有示例的Java EnumSetSupplementOf()方法

發(fā)布時(shí)間:2023/12/1 java 35 豆豆
生活随笔 收集整理的這篇文章主要介紹了 java 方法 示例_带有示例的Java EnumSetSupplementOf()方法 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

java 方法 示例

EnumSet類complementOf()方法 (EnumSet Class complementOf() method)

  • complementOf() method is available in java.util package.

    clipartOf()方法在java.util包中可用。

  • complementOf() method is used to contain all the elements of this EnumSet that are complement in the given EnumSet.

    clipartOf()方法用于包含此EnumSet的所有元素,這些元素在給定的EnumSet中是互補(bǔ)的。

  • complementOf() method is a static method, it is accessible with the class name and if we try to access the method with the class object then we will not get an error.

    complementOf()方法是一個(gè)靜態(tài)方法,可以使用類名進(jìn)行訪問,如果嘗試使用類對(duì)象訪問該方法,則不會(huì)出錯(cuò)。

  • complementOf() method may throw an exception at the time of returning complement EnumSet.

    在返回補(bǔ)碼EnumSet時(shí), complementOf()方法可能會(huì)引發(fā)異常。

    NullPointerException: This exception may throw when the given parameter is null exists.

    NullPointerException :當(dāng)給定參數(shù)為null時(shí),可能引發(fā)此異常。

Syntax:

句法:

public static EnumSet complementOf(EnumSet es);

Parameter(s):

參數(shù):

  • EnumSet es – represents the another enum set from whose complement to assign this enum set.

    EnumSet es –表示另一個(gè)枚舉集,從該枚舉的補(bǔ)碼中分配該枚舉集。

Return value:

返回值:

The return type of this method is EnumSet, it returns complement enum set of the given enum set.

此方法的返回類型為EnumSet ,它返回給定枚舉集的互補(bǔ)枚舉集。

Example:

例:

// Java program is to demonstrate the example of // complementOf(EnumSet es) method of EnumSetimport java.util.*;public class ComplementOfEnumSet {// Initialize a enum variable// with some constantspublic enum Colors {RED,BLUE,GREEN,PURPLE,YELLOW};public static void main(String[] args) {// Here , we are creating two EnumSet// First EnumSet is intiatize with some // values and Second EnumSet is emptyEnumSet < Colors > es = EnumSet.of(Colors.PURPLE);EnumSet < Colors > complement_es = null;// Display EnumSetSystem.out.println("EnumSet (es): " + es);// By using complementOf() method is to // contain all of the elements that does// not exists in the given EnumSet escomplement_es = EnumSet.complementOf(es);// Display EnumSetSystem.out.println("EnumSet.complementOf(es): " + complement_es);} }

Output

輸出量

EnumSet (es): [PURPLE] EnumSet.complementOf(es): [RED, BLUE, GREEN, YELLOW]

翻譯自: https://www.includehelp.com/java/enumset-complementof-method-with-example.aspx

java 方法 示例

總結(jié)

以上是生活随笔為你收集整理的java 方法 示例_带有示例的Java EnumSetSupplementOf()方法的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。