FP
General functional programming utilities.
Attributes
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
FP.type
Members list
Value members
Concrete methods
Asserts a condition and returns a success or failure based on the outcome. If the condition is true, the method returns a success containing the value t. Otherwise, it returns a failure with an AssertionError containing the provided message.
Asserts a condition and returns a success or failure based on the outcome. If the condition is true, the method returns a success containing the value t. Otherwise, it returns a failure with an AssertionError containing the provided message.
Type parameters
- T
-
the type of the value contained in the
Try.
Value parameters
- b
-
the condition to be asserted, which determines success or failure.
- msg
-
the error message to include in the
AssertionErrorif the condition is false. - t
-
the value to be returned in the
Successcase if the condition is true.
Attributes
- Returns
-
a
Try[T]containing the valuetas aSuccessif the condition is true, or aFailurewith anAssertionErrorif the condition is false.
Method to determine if the String w was found at a valid index (i).
Method to determine if the String w was found at a valid index (i).
Value parameters
- i
-
the index found.
- w
-
the String (ignored unless there's an exception).
Attributes
- Returns
-
Success(i) if all well, else Failure(exception).
Lifts a function f of type A => B into a function that operates on Option. The resulting function applies the given function f to the value inside an Option if it is defined and returns the transformed Option.
Lifts a function f of type A => B into a function that operates on Option. The resulting function applies the given function f to the value inside an Option if it is defined and returns the transformed Option.
Type parameters
- A
-
the input type of the function
f. - B
-
the output type of the function
f.
Value parameters
- f
-
the function to be lifted, which takes a value of type
Aand returns a value of typeB.
Attributes
- Returns
-
a function that takes an
Option[A]and returns anOption[B]by applyingfto the value inside theOptionif it exists.
Limits the number of elements displayed from an iterable collection when converted to a string. Appends additional information if the size of the collection exceeds the specified limit.
Limits the number of elements displayed from an iterable collection when converted to a string. Appends additional information if the size of the collection exceeds the specified limit.
Type parameters
- X
-
the type of elements in the input collection.
Value parameters
- limit
-
the maximum number of elements to include in the output string.
- sep
-
the separator string to use between elements in the output string (defaults to ", ").
- xs
-
the iterable collection of elements to be processed.
Attributes
- Returns
-
a string representation of up to
limitelements from the collection, concatenated with thesepstring. If the collection has more elements than the limit, appends a summary of the remaining count.
Limits the number of elements displayed from an iterable collection when converted to a string. Appends additional information if the size of the collection exceeds the specified limit.
Limits the number of elements displayed from an iterable collection when converted to a string. Appends additional information if the size of the collection exceeds the specified limit.
Type parameters
- X
-
the type of elements in the input collection.
Value parameters
- limit
-
the maximum number of elements to include in the output string.
- sep
-
the separator string to use between elements in the output string (defaults to ", ").
- xi
-
the iterator of elements to be processed.
Attributes
- Returns
-
a string representation of up to
limitelements from the collection, concatenated with thesepstring. If the collection has more elements than the limit, appends a summary of the remaining count.
Creates an iterator for a mutable queue that allows sequential access to its elements. Each call to next dequeues an element from the queue, modifying the original queue.
Creates an iterator for a mutable queue that allows sequential access to its elements. Each call to next dequeues an element from the queue, modifying the original queue.
Type parameters
- T
-
the type of elements in the queue.
Value parameters
- queue
-
the mutable queue containing elements of type
Tto be iterated over. The queue is modified as elements are consumed.
Attributes
- Returns
-
an iterator over the elements of the mutable queue, consuming elements as they are accessed.
Method to partition a method to combine elements of Try.
Method to partition a method to combine elements of Try.
Type parameters
- X
-
the underlying type
Value parameters
- xys
-
an Iterator of Try[X]
Attributes
- Returns
-
a tuple of two iterators of Try[X], the first one being successes, the second one being failures.
Method to partition a method to combine elements of Try.
Method to partition a method to combine elements of Try.
TEST
Type parameters
- X
-
the underlying type
Value parameters
- xys
-
a Seq of Try[X]
Attributes
- Returns
-
a tuple of two Seqs of Try[X], the first one being successes, the second one being failures.
Method to yield a URL for a given resourceForClass in the classpath for C.
Method to yield a URL for a given resourceForClass in the classpath for C.
Type parameters
- C
-
a class of the package containing the resourceForClass.
Value parameters
- resourceName
-
the name of the resourceForClass.
Attributes
- Returns
-
Try[URL].
Method to yield a Try[URL] for a resource name and a given class.
Method to yield a Try[URL] for a resource name and a given class.
Value parameters
- clazz
-
the class, relative to which, the resource can be found (defaults to the caller's class).
- resourceName
-
the name of the resource.
Attributes
- Returns
-
Try[URL]
Combines a sequence of optional values into a single optional sequence, preserving the order of elements and excluding any None values. If the input sequence contains only None values, the result will be None. Some(Nil) will never be returned.
Combines a sequence of optional values into a single optional sequence, preserving the order of elements and excluding any None values. If the input sequence contains only None values, the result will be None. Some(Nil) will never be returned.
Type parameters
- T
-
the type of the elements inside the
Option.
Value parameters
- tos
-
the sequence of optional values to be combined.
Attributes
- Returns
-
an
Optioncontaining a sequence of all values extracted from the input sequence, orNoneif there are no such values present.
Sequence method to combine elements of Try.
Sequence method to combine elements of Try.
Type parameters
- X
-
the underlying type
Value parameters
- xys
-
an Iterator of Try[X]
Attributes
- Returns
-
a Try of Iterator[X]
Sequence method to combine elements of Try.
Sequence method to combine elements of Try.
Type parameters
- X
-
the underlying type
Value parameters
- xos
-
an Iterator of Try[X]
Attributes
- Returns
-
a Try of Iterator[X]
Sequence method to combine elements of Try.
Sequence method to combine elements of Try.
Type parameters
- X
-
the underlying type
Value parameters
- xys
-
an Iterable of Try[X]
Attributes
- Returns
-
a Try of Seq[X] NOTE: that the output collection type will be Seq, regardless of the input type
Sequence method to combine elements of Try.
Sequence method to combine elements of Try.
Type parameters
- X
-
the underlying type
Value parameters
- xos
-
an Iterable of Option[X]
Attributes
- Returns
-
an Option of Seq[X] NOTE: that the output collection type will be Seq, regardless of the input type
Applies a side-effecting function f to a lazily evaluated value x, and then returns x.
Applies a side-effecting function f to a lazily evaluated value x, and then returns x.
Type parameters
- X
-
the type of the value being processed.
Value parameters
- f
-
a function that performs a side effect on the value of type
X. - x
-
a lazily evaluated value of type
X.
Attributes
- Returns
-
the original value
xafter the side effect is applied.
Method to transform a Try[X] into an Option[X]. But unlike "toOption," a Failure can be logged.
Method to transform a Try[X] into an Option[X]. But unlike "toOption," a Failure can be logged.
Type parameters
- X
-
the underlying type.
Value parameters
- f
-
a function to process any Exception (typically a logging function).
- xy
-
the input Try[X].
Attributes
- Returns
-
an Option[X].