Join Carlos Rivas for an in-depth discussion in this video Generate JSON output, part of Code Clinic: Java.
- [Instructor] In part 2 of this service method,…we need to access our data arrays using the seconds…passed since midnight to make it look like the matrix…are being generated right now.…Calling this method will return the data to the current…second, based on the computer's clock.…We have the seconds passed already calculated,…so let's use it to construct the map structure.…By the way, Spring Boot takes care of converting this map…structure into a JSON document.…
Let's start by creating an empty HashMap.…So we'll continue where we left off…creating our HashMap, we're going to call map.…Once this is constructed, we're going to proceed to populate…it with the values from our arrays.…Let's type in pulsometer reading.…We have an array with the same name.…We're going to do get and this is the important part.…
We're going to use secondsPassed as index to access our array.…We'll do the same for the red values,…labeled as r and the same process to get the data,…r.get using secondsPassed as the index.…We'll repeat this, our green values as well as blue values.…
Visit other courses in the series to see how to solve the exact same challenges in languages like C#, C++, PHP, Python, and Ruby.
Skill Level Intermediate
1. Problem 1: Pond Oreille
2. Problem 2: Where Am I?
3. Problem 3: Eight Queens
4. Problem 4: Accessing Peripherals
5. Problem 5: Facial Recognition
6. Problem 6: Real-Time Information Dashboard
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.