Class MapHofApps

java.lang.Object
hof.map.assignment.MapHofApps

public class MapHofApps
extends java.lang.Object
Author:
__STUDENT_NAME__, Dennis Cosgrove (http://www.cse.wustl.edu/~cosgroved/)
  • Constructor Summary

    Constructors 
    Constructor Description
    MapHofApps()  
  • Method Summary

    Modifier and Type Method Description
    static ImmutableList<java.lang.Integer> mapToLengths​(ImmutableList<java.lang.String> texts)
    Creates and returns a list whose contents are the lengths of the specified input texts.
    static ImmutableList<java.lang.Boolean> mapToStrictlyLessThan​(ImmutableList<java.lang.Integer> xs, int threshold)
    Creates and returns a list whose contents are the results of whether or not the specified input items are strictly less than the specified threshold.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • mapToLengths

      public static ImmutableList<java.lang.Integer> mapToLengths​(ImmutableList<java.lang.String> texts)
      Creates and returns a list whose contents are the lengths of the specified input texts. The order in the input texts must be preserved in the result. For example, if the input is ["programming", "languages", "Dan"] then the returned list should be [11, 9, 3].
      Parameters:
      texts - the specified list of texts
      Returns:
      the lengths of the specified texts
    • mapToStrictlyLessThan

      public static ImmutableList<java.lang.Boolean> mapToStrictlyLessThan​(ImmutableList<java.lang.Integer> xs, int threshold)
      Creates and returns a list whose contents are the results of whether or not the specified input items are strictly less than the specified threshold. For example, if the input list is [131, 71, 66, 99, 425, 231, 4, 12] and the threshold is 99 then the returned list should be [false, true, true, false, false, false, true, true].
      Parameters:
      xs - the input list of values
      threshold - value used to determine less than
      Returns:
      a list which holds whether or not each value is less than threshold or not