- What is a loop?
- When would you use a loop?
- Why would you use a loop?
- When to use a for loop
- Counting
- Iterating through an array/collection
| package library; | |
| public class Book { | |
| private String title; | |
| private String isbn; | |
| private String author; | |
| private String category; | |
| public String getTitle() { |
| package library; | |
| public class Book { | |
| private String title; | |
| private String isbn; | |
| private String author; | |
| private String category; | |
| public String getTitle() { |
| def dirElements = [['src'],['main', 'test'],['java', 'resources']].combinations() | |
| println "elements are $dirElements" | |
| dirElements.each { | |
| def dir = new File(it.join(File.separator)) | |
| println "checking for $dir" | |
| if(!dir.exists()) { |
| package genes; | |
| public class SubstringFinder { | |
| private String firstString; | |
| private String secondString; | |
| public SubstringFinder(String parent, String child) { | |
| this.firstString = parent; | |
| this.secondString = child; |
| package genes; | |
| public class SequenceFinder { | |
| private String parent; | |
| private String child; | |
| public SequenceFinder(String parent, String child) { | |
| this.parent = parent; | |
| this.child = child; |
| package org.wecancodeit.objects.maps; | |
| import java.util.ArrayList; | |
| import java.util.List; | |
| import org.wecancodeit.objects.students.Student; | |
| public class StudentRecords { | |
| public static void main(String[] args) { |
| package org.wecancodeit.objects.arraylists; | |
| import java.util.ArrayList; | |
| public class Numbers { | |
| public static void main(String[] args) { | |
| ArrayList<Integer> numbers = new ArrayList<Integer>(); | |
| numbers.add(42); |
| package hello; | |
| import javax.annotation.Resource; | |
| import org.springframework.stereotype.Controller; | |
| import org.springframework.ui.Model; | |
| import org.springframework.web.bind.annotation.RequestMapping; | |
| import org.springframework.web.bind.annotation.RequestParam; | |
| @Controller |
| import java.util.Arrays; | |
| import java.util.List; | |
| import java.util.function.Function; | |
| public class Demo { | |
| public static void main(String[] args) { | |
| Grill grill = new Grill(); | |
| Cooker broilReference = () -> grill.broil("Steak"); |