NonAppendable

com.phasmidsoftware.visitor.misc.NonAppendable
case class NonAppendable[X](f: X => Unit) extends Appendable[X]

A case class implementation of the Appendable trait which executes a provided function when an element is appended.

The NonAppendable class takes a function f as a parameter, which is invoked with the appended element whenever the append method is called. This implementation is a simple wrapper that enables side effects or custom handling of appended elements without retaining any internal state.

Type parameters

X

the type of elements that can be appended to this Appendable

Value parameters

f

a function to be executed with each appended element

Attributes

Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait Appendable[X]
trait AutoCloseable
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def append(x: X): Appendable[X]

"Appends" the specified element to this Appendable object, returning a new instance of the Appendable with the element included. In reality, nothing is appended. However, there is a side effect in that the function f is invoked on the given value of x.

"Appends" the specified element to this Appendable object, returning a new instance of the Appendable with the element included. In reality, nothing is appended. However, there is a side effect in that the function f is invoked on the given value of x.

Value parameters

x

the element to be "appended"

Attributes

Returns

a new Appendable[X] instance containing the existing elements and the newly appended element

def close(): Unit

Inherited methods

def productElementNames: Iterator[String]

An iterator over the names of all the elements of this product.

An iterator over the names of all the elements of this product.

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

An iterator over all the elements of this product.

An iterator over all the elements of this product.

Attributes

Returns

in the default implementation, an Iterator[Any]

Inherited from:
Product