第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定

目前沒看到有問題..

package?hyhy_collection_map_demo;

/**

?**

?*?1?創(chuàng)建?List<String>?泛型,添加十條隨機字符串;

?*?2?每條字符的長度為10以內的隨機整數;

?*?3?每條字符串的每個字符都為隨機生成的字符,字符可以重復;

?*?4?每條隨機字符串不可以重復。

?*/

import?java.util.ArrayList;
import?java.util.Collections;
import?java.util.List;
import?java.util.Random;

public?class?SortPractice?{
	public?List<String>?listSort;

	public?void?listBorn()?{
		this.listSort?=?new?ArrayList<String>();
		String?base?=?"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
		Random?random?=?new?Random(48);

		String?sb1;
		for?(int?i?=?0;?i?<?10;?i++)?{
			do?{
				StringBuilder?sb?=?new?StringBuilder();
				Integer?k?=?random.nextInt(10)?+?1;
				for?(int?j?=?0;?j?<?k;?j++)?{
					sb.append(base.charAt(random.nextInt(base.length())));
				}
				sb1?=?sb.toString();

			}?while?(listSort.contains(sb1));
			listSort.add(sb1);
			System.out.println("成功添加字符串:"?+?sb1);
		}
		System.out.println("---------排序前---------");
		for?(String?sb?:?listSort)?{
			System.out.println("字符串:"?+?sb);
		}
		System.out.println("---------排序后----------");
		Collections.sort(listSort);
		for?(String?sb?:?listSort)?{
			System.out.println("字符串:"?+?sb);
		}
	}

	public?static?void?main(String[]?args)?{
		SortPractice?sp?=?new?SortPractice();
		sp.listBorn();
	}

}


正在回答

1 回答

沒問題啊

0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

目前沒看到有問題..

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號