Just use layers(0) instead of getLayer(0).
See
http://docs.geotools.org/latest/userguide/tutorial/map/style.html#creating-a
-style-based-on-the-selection for an updated version of the tutorial. The
old version assumes 2.7 (per pom.xml at the top of the page you linked to).
HTH.
Brad
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
GeoTools-Devel mailing list
GeoTools-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel