alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Scala example source code file (spec-cyclic.scala)

This example Scala source code file (spec-cyclic.scala) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Scala tags/keywords

a, a, anyref, b, b, colmap, colmap, colranged, colsorted, colsorted, foo, int, jclmap, jclranged

The Scala spec-cyclic.scala source code

trait AbsFun[@specialized -A, @specialized +B] {
  def apply(x: A): B
}

trait MyPartialFunction[-A, +B] extends AnyRef with AbsFun[A, B]

trait ColMap[A, +B] extends MyPartialFunction[A, B] /*with Collection[(A, B)] */

trait ColSorted[K,+A] extends ColRanged[K,A] 

trait ColSortedMap[K,+E] extends ColMap[K,E] with ColSorted[K,Tuple2[K,E]] 

trait MutMap[A, B] extends AnyRef
      with ColMap[A, B]

trait ColRanged[K, +A] //extends Iterable[A] 

trait JclRanged[K,A] extends ColRanged[K,A] //with MutableIterable[A] {

trait JclMap[K,E] extends /*collection.jcl.MutableIterable[Tuple2[K,E]] with*/ MutMap[K,E] 

trait JclSorted[K,A] extends ColSorted[K,A] with JclRanged[K,A]

trait JclSortedMap[K,E] extends ColSortedMap[K,E] with JclMap[K,E] with JclSorted[K,Tuple2[K,E]]

class Foo[A, B] extends JclSortedMap[A, B] {
  def apply(x: A): B = error("NYI")
}

class Bar {
  val x: Foo[Int, Int] = new Foo[Int, Int]
  x.apply(0)
}

Other Scala examples (source code examples)

Here is a short list of links related to this Scala spec-cyclic.scala source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.