Skip to content

Instantly share code, notes, and snippets.

@jeszy75
Created March 4, 2022 09:24
Show Gist options
  • Save jeszy75/f0c308075e0adba06f1b1a3b9718bbe4 to your computer and use it in GitHub Desktop.
Save jeszy75/f0c308075e0adba06f1b1a3b9718bbe4 to your computer and use it in GitHub Desktop.
Java Reflection Assignments

Java Reflection Assignments

Write a stream pipeline that:

  1. Prints the declared methods of java.lang.String sorted by name.

  2. Prints all distinct names of the declared methods of java.lang.String sorted alphabetically.

  3. Prints the declared methods of java.lang.String with two or more parameters whose parameters are all of the same type, sorted by name.

  4. Prints all distinct return types of the declared methods of java.lang.String sorted alphabetically.

  5. Prints the declared methods of java.lang.String with at least one boolean parameter, sorted by name.

  6. Prints the declared methods of java.lang.String whose parameters are all of type int, sorted by name.

  7. Returns the longest one from the names of the public methods of java.lang.String.

  8. Returns summary statistics about the number of parameters for the declared methods of java.lang.String.

  9. Returns the maximum number of parameters accepted by the declared methods of java.lang.String.

  10. Returns the declared method of java.lang.String with the most number of parameters.

  11. Prints all distinct parameter types of the declared methods of java.lang.String sorted alphabetically.

Javadoc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment