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

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中是互補的。

  • 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()方法是一個靜態方法,可以使用類名進行訪問,如果嘗試使用類對象訪問該方法,則不會出錯。

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

    在返回補碼EnumSet時, complementOf()方法可能會引發異常。

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

    NullPointerException :當給定參數為null時,可能引發此異常。

Syntax:

句法:

    public static EnumSet complementOf(EnumSet es);

Parameter(s):

參數:

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

    EnumSet es –表示另一個枚舉集,從該枚舉的補碼中分配該枚舉集。

Return value:

返回值:

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

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

Example:

例:

// Java program is to demonstrate the example of
// complementOf(EnumSet es) method of EnumSet
import java.util.*;
public class ComplementOfEnumSet {
// Initialize a enum variable
// with some constants
public 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 empty
EnumSet < Colors > es = EnumSet.of(Colors.PURPLE);
EnumSet < Colors > complement_es = null;
// Display EnumSet
System.out.println("EnumSet (es): " + es);
// By using complementOf() method is to 
// contain all of the elements that does
// not exists in the given EnumSet es
complement_es = EnumSet.complementOf(es);
// Display EnumSet
System.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 方法 示例

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/378861.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/378861.shtml
英文地址,請注明出處:http://en.pswp.cn/news/378861.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

在需要時開啟Perl新特性

從5.10開始&#xff0c;新特性必須開啟才能使用。Perl默認不啟用新特性保持向后兼容。 如果想啟用新特性&#xff0c;可以使用新的-E開關。打開所有的新特性。 % perl5.10.1 -E say.pl #開啟5.10.1 版本的所有新特性 在源代碼中使用 use 指令之后指定perl版本號就可以了。 use …

P2P技術詳解(一):NAT詳解——詳細原理、P2P簡介

目錄1. IPv4協議和NAT的由來2. NAT的工作模型和特點2.1、NAT的概念模型2.2、一對一的NAT2.3、一對多的NAT2.4、按照NAT端口映射方式分類2.4.1全錐形NAT2.4.2限制錐形NAT2.4.3端口限制錐形NAT2.4.4對稱型NAT3. NAT的限制與解決方案3.1、IP端到端服務模型3.2、NAT的弊端3.3、NAT穿…

決定孩子命運的八大關鍵問題

你可以不是天才&#xff0c;但你可以是天才的父母&#xff01;樹立做父母正確的家庭教育觀念&#xff0c;為孩子建造一個良好的人生平臺&#xff0c;讓孩子有很好的人格修養&#xff0c;懂得做人&#xff0c;懂得成功的真正含義。簡單方便&#xff0c;容易操作&#xff0c;適合…

java calendar_Java Calendar internalGet()方法與示例

java calendar日歷類internalGet()方法 (Calendar Class internalGet() method) internalGet() method is available in java.util package. internalGet()方法在java.util包中可用。 internalGet() method is used to get the value of the given field(fi) of this Calendar …

顯示照片的二維直方圖

顯示照片的二維直方圖 import cv2 from matplotlib import pyplot as plt img cv2.imread(E:\Python-workspace\OpenCV\OpenCV/water1.png,1)#第一個參數為選擇照片的路徑&#xff0c;注意照片路徑最后一個為正斜杠其他都為反斜杠&#xff1b;第二個參數&#xff0c;其中1表示…

周五怎么表示 mysql_完美起航-MySQL找每個月最后一個星期五--函數定義與使用

數據庫作業有一道題是這樣子的&#xff1a;有一張名叫emp的表記錄員工信息&#xff0c;其中有如下字段 HIREDATE 表示員工被雇用的日期&#xff1a;然后問題是這樣的&#xff1a;q7.Show details of employee hiredates and the date of their first payday.(Paydays occur on…

要想能安心,必須先死心。

其實&#xff0c;不論是感情&#xff0c;還是學習、工作還是生活&#xff0c;不都是如此&#xff1f;曾經年少懷抱一個名校夢&#xff0c;如果高考不成功&#xff0c;那么你一定會選擇考研讓自己死一次心&#xff1b;小時候特別喜歡 某個職業&#xff0c;長大了你拋棄所有機會追…

silverlight學習總結【完】

以下內容是個人理解&#xff0c;不保證正確性。且假設使用C#&#xff0c;并且有一定的相關知識和XML基礎。 silverlight是什么&#xff0c;能做什么 silverlight用XAML來做前端界面&#xff0c;用.NET或者JS作為程序腳本支持&#xff0c;在瀏覽器內外運行的應用。可以認為和FLA…

P2P技術詳解(二):P2P中的NAT穿越(打洞)方案詳解

目錄1、內容概述2、反向鏈接技術&#xff1a;一種特殊的P2P場景&#xff08;通信雙方中只有一方位于NAT設備之后&#xff09;3、基于UDP協議的P2P打洞技術詳解3.1、原理概述3.2、典型P2P情景1&#xff1a; 兩客戶端位于同一NAT設備后面&#xff08;即相同內網中&#xff09;3.3…

Java Byte類的compareTo()方法和示例

簡短的類compareTo()方法 (Short class compareTo() method) compareTo() method is available in java.lang package. compareTo()方法在java.lang包中可用。 compareTo() method is used to check equality or inequality for this Byte object against the given Byte objec…

顯示照片的RGB直方圖

顯示照片的RGB直方圖 import numpy as np import cv2 as cv from matplotlib import pyplot as plt img cv.imread(E:\Python-workspace\OpenCV\OpenCV/BEYOND.png,1)#第一個參數為選擇照片的路徑&#xff0c;注意照片路徑最后一個為正斜杠其他都為反斜杠&#xff1b;第二個參…

OUT還開通博客!

現在哪有人還在玩博客哦&#xff0c;哎試試&#xff0c;記錄一下自己開發網站的點滴吧&#xff01;轉載于:https://www.cnblogs.com/17say/archive/2013/02/18/2915125.html

網站V5的一些想法(轉)

V5即將到來&#xff0c;面對“全新”的V5&#xff0c;前端這塊自然也要借這次改版的機會&#xff0c;將我們前端的一些想法實踐到V5中去&#xff0c;實現一次跨越。 1 嘗試模塊化的代碼書寫(html、css等) 模塊化的目的是為了提高代碼的重用性、擴展性、可維護性 2 文件引用使用…

mysql慢查詢開啟語句分析_mysql慢查詢語句分析總結

我們經常會接觸到MySQL&#xff0c;也經常會遇到一些MySQL的性能問題。我們可以借助慢查詢日志和explain命令初步分析出SQL語句存在的性能問題通過SHOW FULL PROCESSLIST查看問題SHOW FULL PROCESSLIST相當于select * from information_schema.processlist可以列出正在運行的連…

P2P技術詳解(三):P2P中的NAT穿越(打洞)方案詳解(進階分析篇)

目錄1、NAT和NAPT2、NAT帶來的問題3、P2P通信穿越NAT的技術、方法4、NAT穿越技術1&#xff1a;應用層網關4.1、原理4.2、限制5、NAT穿越技術2&#xff1a;中間件技術5.1、原理5.2、限制6、NAT穿越技術3&#xff1a;打洞技術(Hole Punching)6.1、原理6.2、方法6.2.1NAT行為類型與…

Java BufferedReader reset()方法及示例

BufferedReader類的reset()方法 (BufferedReader Class reset() method) reset() method is available in java.io package. reset()方法在java.io包中可用。 reset() method is used to reset the stream to the most recent mark of this stream. reset()方法用于將流重置為該…

將兩大小完全相同的照片進行加權混合對比

將兩張大小完全相同的照片進行加權混合對比 import cv2 img1cv2.imread(E:\Python-workspace\OpenCV\OpenCV/water1.png,1)#第一個參數為選擇照片的路徑&#xff0c;注意照片路徑最后一個為正斜杠其他都為反斜杠&#xff1b;第二個參數&#xff0c;其中1表示所選照片為彩色照片…

過了很久了

很久沒來這里了&#xff0c;一般也就找找資料會上一下子。差不多算是荒廢了吧 不要緊&#xff0c;開始寫了轉載于:https://www.cnblogs.com/Anykong/archive/2013/02/18/2916333.html

古文中驚艷的句子

-1】終于為那一身江南煙雨覆了天下&#xff0c;容華謝后&#xff0c;不過一場&#xff0c;山河永寂。-2】千秋功名&#xff0c;一世葬你&#xff0c;玲瓏社稷&#xff0c;可笑卻無君王命。-3】鳳凰臺上鳳凰游&#xff0c;負約而去&#xff0c;一夜苦等&#xff0c;從此江南江北…

java 方法 示例_Java ArrayDeque pollFirst()方法與示例

java 方法 示例ArrayDeque類pollFirst()方法 (ArrayDeque Class pollFirst() method) pollFirst() Method is available in java.lang package. pollFirst()方法在java.lang包中可用。 pollFirst() Method is used to return the first element of the queue denoted by this d…