CSE 115 Lecture 27: 04.01.16 lecture notes

80 views4 pages

Document Summary

//a method that takes an arraylist as argument and returns false if the first string has length 5, false otherwise. Arraylist is empty, return false public boolean firststringoflength5(array list) { if (list == null || list. size() == 0) { return false; String firststring = list. get(0); return firststring != null && firststring. length() == 5; //a method that takes an arraylist as argument and returns true if it contains a string of length 5, false otherwise. Arraylist is empty, return false public boolean hasstringoflength5(arraylist list) { if (list == null || list. size() == 0) { return false; for (string s : list) { if (s != null && s. length() ==5) { return true; return false; Use a regular loop public int howmanystringsoflength5_v2(arraylist

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Questions