2626import org .apache .wicket .markup .html .basic .Label ;
2727import org .apache .wicket .markup .html .form .ChoiceRenderer ;
2828import org .apache .wicket .markup .html .form .DropDownChoice ;
29+ import org .apache .wicket .markup .html .form .EnumChoiceRenderer ;
2930import org .apache .wicket .markup .html .form .Form ;
31+ import org .apache .wicket .markup .html .form .LambdaChoiceRenderer ;
3032import org .apache .wicket .markup .html .form .ListMultipleChoice ;
3133import org .apache .wicket .markup .html .link .BookmarkablePageLink ;
3234import org .apache .wicket .model .PropertyModel ;
@@ -50,17 +52,17 @@ public class HomePage extends WebPage
5052 @ SuppressWarnings ("unused" )
5153 private Country countryDropDownChoice = Country .US ;
5254 @ SuppressWarnings ("unused" )
53- private List <Country > countries = new ArrayList <>(Arrays . asList ( new Country [] { Country .US , Country .CA } ));
55+ private List <Country > countries = new ArrayList <>(List . of ( Country .US , Country .CA ));
5456 @ SuppressWarnings ("unused" )
55- private List <Country > ajaxcountries = new ArrayList <>(Arrays . asList ( new Country [] { Country .US , Country .CA } ));
57+ private List <Country > ajaxcountries = new ArrayList <>(List . of ( Country .US , Country .CA ));
5658 @ SuppressWarnings ("unused" )
57- private List <Country > ajaxcountriesns = new ArrayList <>(Arrays . asList ( new Country [] { Country .US , Country .CA } ));
59+ private List <Country > ajaxcountriesns = new ArrayList <>(List . of ( Country .US , Country .CA ));
5860 @ SuppressWarnings ("unused" )
59- private List <Country > countriesListMultipleChoice = new ArrayList <>(Arrays . asList ( new Country [] { Country .US , Country .CA } ));
61+ private List <Country > countriesListMultipleChoice = new ArrayList <>(List . of ( Country .US , Country .CA ));
6062 @ SuppressWarnings ("unused" )
6163 private List <String > tags = new ArrayList <>(Arrays .asList ("tag1" , "tag2" ));
6264 @ SuppressWarnings ("unused" )
63- private List <Country > countriesStateless = new ArrayList <>(Arrays . asList ( new Country [] { Country .US , Country .CA } ));
65+ private List <Country > countriesStateless = new ArrayList <>(List . of ( Country .US , Country .CA ));
6466
6567 @ Override
6668 protected void onInitialize () {
@@ -337,15 +339,12 @@ public void query(String term, int page, Response<String> response)
337339 }
338340 }
339341
340- public static class CountryRenderer extends ChoiceRenderer <Country >
342+ public static class CountryRenderer extends LambdaChoiceRenderer <Country >
341343 {
342-
343344 private static final long serialVersionUID = 1L ;
344345
345346 public CountryRenderer () {
346- super ("displayName" , " name" );
347+ super (Country :: getDisplayName , Country :: name );
347348 }
348-
349349 }
350-
351350}
0 commit comments