Java集合unmodifiableSortedSet()方法(帶示例)

集合類unmodifiableSortedSet()方法 (Collections Class unmodifiableSortedSet() method)

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

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

  • unmodifiableSortedSet() method is used to get a non-modifiable view of the given SortedSet (ss).

    unmodifiableSortedSet()方法用于獲取給定SortedSet(ss)的不可修改視圖。

  • unmodifiableSortedSet() 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 also we will not get any error.

    unmodifiableSortedSet()方法是一個靜態方法,可以使用類名進行訪問,如果嘗試使用類對象訪問該方法,那么也不會出現任何錯誤。

  • unmodifiableSortedSet() method does not throw an exception at the time of returning unmodifiable view of the given sorted set.

    在返回給定排序集的不可修改視圖時, unmodifiableSortedSet()方法不會引發異常。

Syntax:

句法:

    public static SortedSet unmodifiableSortedSet(SortedSet ss);

Parameter(s):

參數:

  • SortedSet ss – represents the sorted set object for which a non-modifiable view is to be retrieved.

    SortedSet ss –表示要檢索其不可修改視圖的排序集對象。

Return value:

返回值:

The return type of this method is SortedSet, it returns an unmodifiable view of the given sorted set.

此方法的返回類型為SortedSet ,它返回給定排序集的不可修改的視圖。

Example:

例:

// Java program to demonstrate the example 
// of SortedSet unmodifiableSortedSet() 
// method of Collections
import java.util.*;
public class UnmodifiableSortedSetOfCollections {
public static void main(String args[]) {
// Instantiates a sorted set object
SortedSet < Integer > ss = new TreeSet < Integer > ();
// By using add() method is to add
//objects in a sorted set 
ss.add(20);
ss.add(10);
ss.add(40);
ss.add(30);
ss.add(50);
// Display Sorted Set
System.out.println("SortedSet: " + ss);
// By using unmodifiableSortedSet() method is to
// represent the tree set in unmodifiable view
ss = Collections.synchronizedSortedSet(ss);
// We will get an exception when we 
// try to add an object in an unmodifiable
// sorted set
/* ss.add(60)*/
}
}

Output

輸出量

SortedSet: [10, 20, 30, 40, 50]

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

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

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

相關文章

遠控免殺專題(16)-Unicorn免殺

0x01 免殺能力一覽表 幾點說明&#xff1a; 1、上表中標識 √ 說明相應殺毒軟件未檢測出病毒&#xff0c;也就是代表了Bypass。 2、為了更好的對比效果&#xff0c;大部分測試payload均使用msf的windows/meterperter/reverse_tcp模塊生成。 3、由于本機測試時只是安裝了360全…

面向對象(匿名內部類在開發中的應用)

匿名內部類在開發中的應用 public class test1_NoNameInner {public static void main(String[] args) {PersonDemo yy new PersonDemo();//yy.method(new Student());yy.method(new Person() {public void show(){System.out.println("show");}});//匿名內部類當作…

【匯編語言】乘法(MUL/IMUL)

乘法&#xff08;MUL/IMUL&#xff09; 目錄乘法&#xff08;MUL/IMUL&#xff09;IMUL(signed multiply)有符號數乘法MUL(unsigned multiply)無符號數乘法麻&#xff01;屬實是被這個有符號乘法給整麻了&#xff0c;教材就一行例子直接不解釋了&#xff0c;關于標志位溢出的一…

【轉】MFC學習總結

HBRUSH CAboutDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) { if ((pWnd->GetDlgCtrlID() IDC_EDIT1) && (nCtlColor CTLCOLOR_EDIT)) {   COLORREF clr RGB(255,0,0);   pDC->SetTextColor(clr);  //設置紅色的文本   clr RGB(0,0,0…

NHibernate初學體驗進階篇

在上篇《NHibernate初學體檢記》中&#xff0c;我參照NHibernate官方快速指南寫了兩個示例項目&#xff0c;在示例2的源碼中充斥了如下類似的代碼&#xff1a;<?XML:NAMESPACE PREFIX O />Configuration cfg new Configuration(); cfg.AddAssembly("…

eclipse快捷鍵

Java開發工具(Eclipse的視窗和視圖概述) A:視窗 每一個基本的窗體被稱為視窗 PackageExplorer 顯示項目結構&#xff0c;包&#xff0c;類&#xff0c;及資源Outline 顯示類的結構&#xff0c;方便查找&#xff0c;識別&#xff0c;修改Console 程序運行的結果在該窗口顯示Hie…

【匯編語言】除法(DIV/IDIV)

除法&#xff08;DIV/IDIV&#xff09; 目錄除法&#xff08;DIV/IDIV&#xff09;DIV(unsigned divide)無符號數除法IDIV(signed divide)有符號數除法DIV(unsigned divide)無符號數除法 格式&#xff1a;DIV SRC 操作&#xff1a; SRCSRCSRC為字節時&#xff0c;(AL)←(AX)/…

java 方法 示例_Java集合syncedSortedSet()方法與示例

java 方法 示例集合類SynchronizedSortedSet()方法 (Collections Class synchronizedSortedSet() method) synchronizedSortedSet() method is available in java.util package. java.util軟件包中提供了sharedSortedSet ()方法 。 synchronizedSortedSet() method is used to …

遠控免殺專題(17)-Python-Rootkit免殺

免殺能力一覽表 幾點說明&#xff1a; 1、上表中標識 √ 說明相應殺毒軟件未檢測出病毒&#xff0c;也就是代表了Bypass。 2、為了更好的對比效果&#xff0c;大部分測試payload均使用msf的windows/meterperter/reverse_tcp模塊生成。 3、由于本機測試時只是安裝了360全家桶…

項目管理軟件應用淺析(轉)

項目管理是在一定的約束條件下&#xff0c;以高效率地實現項目業主的目標為目的&#xff0c;以項目經理個人負責制為基礎和以項目為獨立實體進行經濟核算&#xff0c;并按照項目內在的邏輯規律進行有效的計劃、組織、協調、控制的系統管理活動。項目管理的核心技術是網絡計劃技…

斜視角的討論(轉)

http://school.ogdev.net/listshow.asp?page4&typeid0&categoryid5&id0&ListType2 目 錄 1.1 地圖和地表 1.2 斜視角游戲中的視角 1.3 Tile圖片的拼接 1.4 不同地表間的過渡 1.5 地圖數據結構的定義 --------------------------------------------------…

計算機網絡(湖科大教書匠)

計算機網絡&#xff08;湖科大教書匠&#xff09; 本文檔為教學視頻【計算機網絡微課堂&#xff08;有字幕無背景音樂版&#xff09;_嗶哩嗶哩_bilibili】的摘錄 目錄計算機網絡&#xff08;湖科大教書匠&#xff09;一、緒論1.2 因特網概述1.2.1 網絡、互連網&#xff08;互聯…

經緯度

題目描述 給定地球的兩個經緯度坐標&#xff0c;問這兩個點的直線距離。假設地球為球體&#xff0c;半徑為6371009米。 輸入描述: 第一行一個整數T表示數據組數。 接下來n行&#xff0c;每行四個數lat1, lng1, lat2, lng2分別表示兩個點的經緯度。 正數表示北緯和東經。 …

遠控免殺專題(18)-ASWCrypter免殺

免殺能力一覽表 幾點說明&#xff1a; 1、上表中標識 √ 說明相應殺毒軟件未檢測出病毒&#xff0c;也就是代表了Bypass。 2、為了更好的對比效果&#xff0c;大部分測試payload均使用msf的windows/meterperter/reverse_tcp模塊生成。 3、由于本機測試時只是安裝了360全家桶…

Hibernate 筆記4 實現對數據庫的增刪改查

1 準備 首先在mysql數據庫中建表User,并添加相關信息。 user表結構如下。 ---------------------------------------------------------| Field | Type | Null | Key | Default | Extra |------------------------------------------------…

Direct3D中的繪制(3)

立方體——只比三角形稍微復雜一點&#xff0c;這個程序渲染一個線框立方體。 這個簡單的繪制和渲染立方體的程序的運行結果如下圖所示&#xff1a; 源程序&#xff1a; /************************************************************************************** Renders a …

遠控免殺專題(19)-nps_payload免殺

免殺能力一覽表 幾點說明&#xff1a; 1、上表中標識 √ 說明相應殺毒軟件未檢測出病毒&#xff0c;也就是代表了Bypass。 2、為了更好的對比效果&#xff0c;大部分測試payload均使用msf的windows/meterperter/reverse_tcp模塊生成。 3、由于本機測試時只是安裝了360全家桶…

VS2005中使用WebDeploymentProject的問題

近來做Web項目&#xff0c;VS2005中發布網站時默認發布大批的程序集&#xff0c;這給升級網站時造成很大麻煩&#xff0c;所以偶從MS下載了個WebDeploymentProject的插件&#xff08;下載地址http://download.microsoft.com/download/c/c/b/ccb4877f-55f7-4478-8f16-e41886607a…

操作系統中的多級隊列調度

多級隊列調度 (Multilevel queue scheduling) Every algorithm supports a different class of process but in a generalized system, some process wants to be scheduled using a priority algorithm. While some process wants to remain in the system (interactive proce…

編寫一程序,輸入一個字符串,查找該字符串中是否包含“abc”。

import java.lang.String.*;//這里調用java.long.String.contains()方法&#xff1b; import java.util.Scanner; public class shit {public static void main(String[] args) {Scanner wsq new Scanner(System.in);String str wsq.next();boolean status str.contains(&qu…