??????Java???????????????
???????????? ???????[ 2015/4/2 11:44:55 ] ????????Java ???? ???
?????????????ò???????Class???????????????????????Context????ò???????Key??????Class??
????public class Context {
????private final Map<Key<?>?? Object> values = new HashMap<>();
????public <T> void put( Key<T> key?? T value ) {
????values.put( key?? value );
????}
????public <T> T get( Key<T> key ) {
????return key.type.cast( values.get( key ) );
????}
????[...]
????}
?????????????????????汾??Context??
????Context context = new Context();
????Runnable runnable1 = ...
????Key<Runnable> key1 = new Key<>( "id1"?? Runnable.class );
????context.put( key1?? runnable1 );
????Runnable runnable2 = ...
????Key<Runnable> key2 = new Key<>( "id2"?? Runnable.class );
????context.put( key2?? runnable2 );
????// several computation cycles later...
????Runnable actual = context.get( key1 );
????assertThat( actual ).isSameAs( runnable1 );
????????????????ο????????????????Context#get?У?Key??????????????????????identifier??class??????????????Key??????????????put???????????get????get??????????null ???????????????……
????//????????????
????Context context = new Context();
????Runnable runnable1 = ...
????Key<Runnable> key1 = new Key<>( "same-id"?? Runnable.class );
????Key<Runnable> key2 = new Key<>( "same-id"?? Runnable.class );
????context.put( key1?? runnable1 );//???????put
????context.get(key2); //?????????get --> return null;
?????????????Key???????equals ??hashCode ??????????????????????HashMap ?????????????????????????key???????????????????????????static import??????????????
????public static Key key( String identifier?? Class type ) {
????return new Key( identifier?? type );
????}
????????
????“????API?????????????÷????????????????????й???????????????????????????????????????????????????????????????????????????????? ??????????????Class??????????”??Joshua Bloch????Effective Java????29????
?????????????????????????????????????????????????????……
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
Java???????????Щ???????????????Java????????????????Java?б???Map????????Java Web???????????????Java??????????????д?????Java????????7???????????????????????(java .net ?????)???Java??????????Python??????Java webdriver??λ????????′????е?????Java??д??????????????????Java???????????????JavaScript????????????Java?????????????????? Java???????10??????????????Java?м????????????????java???????ü???????????м???????????????????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????е????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????