
丒奺庬曄姺
攝楍 仼 List

	String[] strs = list.toArray(new String[list.size()]);



攝楍 仼 Stream



攝楍偺僟儞僾
	Arrays.toString(strs)


List 仼 攝楍
	List<String> list = Arrays.asList( "list1", "list2", "list3", "list4", "list5" );
	巜掕偝傟偨攝楍偵楢摦偡傞屌掕僒僀僘偺儕僗僩

	String[] array;
	List<String> list = Arrays.asList( array );		// 偦偺傑傑List傪嶌惉
		攝楍偲楢摦偡傞乮攝楍傪曄峏偟偨傜儕僗僩偵斀塮偝傟傞丄儕僗僩傪曄峏偟偨傜攝楍偵斀塮偝傟傞乯
		捛壛(add, addAll)丄嶍彍(remove, clear) 偑偱偒側偄乮UnsupportedOperationException 偑僗儘乕偝傟傞乯

	List<String> list = new ArrayList<String>( Arrays.asList( array ) );	// 僐僺乕偟偰嶌惉

Set 仼 攝楍


Set 仼 Stream
	Stream<String> stream = Stream.of("abc", "def");
	Set<String> set = stream.collect(Collectors.toSet());

Stream 仼 Set
	Set<String> set = new HashSet<>();
	set.add("abc");
	set.add("def");

	Stream<String> stream = set.stream();

	for (宆 曄悢 : set) {
	乣
	}

	set.forEach(曄悢 -> {
	乣
	});

Map.key 仼 攝楍



Map.value 仼 攝楍


============================================

					栠傝抣		捛壛	抲姺	嶍彍
compute							仜		仜		仜
					怴			捛壛	抲姺	null

computeIfAbsent					仜		亊		亊
					媽(寁嶼)	捛壛	媽		媽

computeIfPresent				亊		仜		仜
					怴			null	抲姺	null

merge							弶婜	仜		仜
					怴			弶婜	抲姺	null

putIfAbsent						仜		亊		亊
					媽			null	媽		媽

Map#compute 丗 栠傝抣偼丄怴偟偄抣丅捛壛桳傝丄抲姺桳傝(屻彑)丄嶍彍桳傝
Map#computeIfAbsent 丗 栠傝抣偼丄婛懚偺丄傑偨偼寁嶼偝傟偨抣丅捛壛桳傝丄抲姺側偟(愭彑)丄嶍彍側偟
Map#computeIfPresent 丗 栠傝抣偼丄怴偟偄抣丅捛壛側偟丄抲姺桳傝(屻彑)丄嶍彍桳傝
Map#merge 丗 栠傝抣偼丄怴偟偄抣丅捛壛(弶婜)丄抲姺桳傝(屻彑)丄嶍彍桳傝
Map#putIfAbsent 丗 栠傝抣偼丄埲慜偺抣丅捛壛桳傝丄抲姺側偟(愭彑)丄嶍彍側偟
Map#replaceAll 丗 栠傝抣側偟丅偡傋偰偺抣偱儖乕僾偟偰丄寢壥傪僙僢僩偟傑偡丅
Map#merge + concat 丗 婛懚偺抣傪丄師乆偲愝掕偱偒傑偡丅


C:\InetPub\wwwroot\javatest\java8stream>echo off
original
   仭=null , 嘆=null , 嘑=null
嘆=媽 , 嘇=媽 , 嘊=媽 , 嘋=媽 , 嘍=媽 , 嘐=媽 , 嘑=媽 ,

Map#compute 丗 栠傝抣偼丄怴偟偄抣丅捛壛桳傝丄抲姺桳傝(屻彑)丄嶍彍桳傝
   仭=捛壛 , 嘆=抲姺 , 嘑=null
嘆=抲姺 , 嘇=媽 , 嘊=媽 , 嘋=媽 , 嘍=媽 , 嘐=媽 , 仭=捛壛 ,

Map#computeIfAbsent 丗 栠傝抣偼丄婛懚偺丄傑偨偼寁嶼偝傟偨抣丅捛壛桳傝丄抲姺側偟(愭彑)丄嶍彍側偟
   仭=捛壛 , 嘆=媽 , 嘑=媽
嘆=媽 , 嘇=媽 , 嘊=媽 , 嘋=媽 , 嘍=媽 , 嘐=媽 , 嘑=媽 , 仭=捛壛 ,

Map#computeIfPresent 丗 栠傝抣偼丄怴偟偄抣丅捛壛側偟丄抲姺桳傝(屻彑)丄嶍彍桳傝
   仭=null , 嘆=抲姺 , 嘑=null
嘆=抲姺 , 嘇=媽 , 嘊=媽 , 嘋=媽 , 嘍=媽 , 嘐=媽 ,

Map#merge 丗 栠傝抣偼丄怴偟偄抣丅捛壛(弶婜)丄抲姺桳傝(屻彑)丄嶍彍桳傝
   仭=弶婜 , 嘆=抲姺 , 嘑=null
嘆=抲姺 , 嘇=媽 , 嘊=媽 , 嘋=媽 , 嘍=媽 , 嘐=媽 , 仭=弶婜 ,

Map#putIfAbsent 丗 栠傝抣偼丄埲慜偺抣丅捛壛桳傝丄抲姺側偟(愭彑)丄嶍彍側偟
   仭=null , 嘆=媽 , 嘑=媽
嘆=媽 , 嘇=媽 , 嘊=媽 , 嘋=媽 , 嘍=媽 , 嘐=媽 , 嘑=媽 , 仭=捛壛 ,

Map#replaceAll 丗 栠傝抣側偟丅偡傋偰偺抣偱儖乕僾偟偰丄寢壥傪僙僢僩偟傑偡丅
   仭=null , 嘆=null , 嘑=null
嘆=捛壛 , 嘇=捛壛 , 嘊=捛壛 , 嘋=捛壛 , 嘍=捛壛 , 嘐=捛壛 , 嘑=捛壛 ,

Map#merge + concat 丗 婛懚偺抣傪丄師乆偲愝掕偱偒傑偡丅
   仭=弶婜弶婜弶婜弶婜弶婜弶婜 , 嘆=媽 , 嘑=媽
嘆=媽 , 嘇=媽 , 嘊=媽 , 嘋=媽 , 嘍=媽 , 嘐=媽 , 嘑=媽 , 仭=弶婜弶婜弶婜弶婜弶婜弶婜 ,

弶婜抣偑晄梫側応崌偱傕幚峴偝傟傞偐丠捛壛
弶婜抣偑晄梫側応崌偱傕幚峴偝傟傞偐丠抲姺
Map#merge + StringBuilder 丗 婛懚偺抣傪丄師乆偲愝掕偱偒傑偡丅弶婜抣偼昁偢幚峴偝傟傑偡丅
   仭=null , 嘆=null , 嘑=null
嘆=媽抲姺 , 嘇=媽 , 嘊=媽 , 嘋=媽 , 嘍=媽 , 嘐=媽 , 嘑=媽 , 仭=捛壛 ,

弶婜抣偑晄梫側応崌偱傕幚峴偝傟傞偐丠捛壛
Map#compute 丗 怴偟偄抣丅弶婜抣傪帺暘偱敾抐偟偰丄嶌惉偡傞偐偳偆偐寛傔傜傟傑偡丅
   仭=捛壛 , 嘆=抲姺 , 嘑=null
嘆=抲姺 , 嘇=媽 , 嘊=媽 , 嘋=媽 , 嘍=媽 , 嘐=媽 , 仭=捛壛 ,

懕峴偡傞偵偼壗偐僉乕傪墴偟偰偔偩偝偄 . . .
