object NonEmpty
- Alphabetic
- By Inheritance
- NonEmpty
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def apply[Fct, A, C <: Iterable[A]](into: Fct, hd: A, tl: A*)(implicit fct: (Fct) => Factory[A, C]): NonEmpty[C]
NonEmpty(List, 1, 2, 3) : NonEmpty[List[Int]] // with (1, 2, 3) as elements
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @IntrinsicCandidate()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def equiv[F[_], A]: ===[NonEmpty[F[A]], NonEmptyF[F, A]]
Usable proof that NonEmptyF is actually equivalent to its NonEmpty parent type, not a strict subtype.
- final def from[Self](self: Self with Iterable[_]): Option[NonEmpty[Self]]
Like
unapply
, but when you don't want pattern matching. - final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @IntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @IntrinsicCandidate()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def mk[Fct, A, C[X] <: Iterable[X]](into: Fct, hd: A, tl: A*)(implicit fct: (Fct) => Factory[A, C[A]]): NonEmpty[C[A]]
Like
apply
, but becauseA
occurs directly in the result type, if the call tomk
has an expectedA
type,hd
andtl
will have that expected type as well.Like
apply
, but becauseA
occurs directly in the result type, if the call tomk
has an expectedA
type,hd
andtl
will have that expected type as well. Particularly useful forSet
s, as expected type can widen the element type of the produced set, and_
as an argument, because the lambda argument type can be inferred from the expected result type.However, strictly speaking, it is less general than
apply
; for example, it doesn't work onMap
s at all. So it should only be used when you need its particular type inference behavior. See"mk" should
tests inNonEmptySpec.scala
for examples wheremk
works butapply
doesn't. - final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
- def subtype[A]: <~<[NonEmpty[A], A]
Usable proof that NonEmpty is a subtype of its argument.
Usable proof that NonEmpty is a subtype of its argument. (We cannot put this in an upper-bound, because that would prevent us from adding implicit methods that replace the stdlib ones.)
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- def unapply[Self](self: Self with Iterable[_]): Option[NonEmpty[Self]]
In pattern matching, think of NonEmpty as a sub-case-class of every imm.Iterable; matching
case NonEmpty(ne)
adds the non-empty type tone
if the pattern matches.In pattern matching, think of NonEmpty as a sub-case-class of every imm.Iterable; matching
case NonEmpty(ne)
adds the non-empty type tone
if the pattern matches.You will get an unchecked warning if the selector is not statically of an immutable type. So scala.collection.Seq will not work.
The type-checker will not permit you to apply this to a value that already has the NonEmpty type, so don't worry about redundant checks here.
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated @Deprecated
- Deprecated