#Using APIs
###Resources
###Exercises
####HashSet
A Set is a data structure that stores a collection of unique values. The values are not stored in a particular order. Java has several different implementations of Set. Today we'll use HashSet.
Exercises:
- Import the HashSet and create a HashSet object.
- Use a HashSet to figure out how many unique words are in A Tale of Two Cities and Moby Dick, respectively. Feel free to refer back to the Verbosity Calculator assignment.
- Clean up the code - your HashSet currently thinks "the." and "the" and "The" are all different words! Do some String operations to make your word counts more accurate.
- Create a set that is the intersection of words between A Tale of Two Cities and Moby Dick. What is the cardinality (size) of this set?
- Create a set that is the union of words between A Tale of Two Cities and Moby Dick.
- Create an iterator for the union set.
- For fun - try this again but with two books from the same author!
####Stripe API Play around with the Stripe API. Stripe makes it easy to integrate payments into your applications - you may even find this useful for your final projects!
To begin, take a look at Stripe's Java library project on Github. This gives an overview of how to include Stripe in your Java project. As we learn Android, some of the different dependency management solutions like Maven or Gradle might make more sense. However, for this project just download the latest jar and include this jar in your project.
Now, using Stripe's Java documentation and the test API key provided try the following exercises:
- Print out the email addresses of all the customers.
- Print out the number of customers.
- Create a charge, then retrieve the same charge.
- Refund the charge you created in step 3.
- Create, update and then delete a customer.
- Create, update and then delete an invoice.
- Try creating or retreiving data from one more type of object of your choosing.