Movatterモバイル変換


[0]ホーム

URL:


This page is no longer maintained — Please continue to the home page atwww.scala-lang.org

Home

Scala Main Menu

Home » Snippet: Implicits

Snippet: Implicits

Created by admin on 2008-07-24. Updated: 2010-03-23, 14:27
/* Defines a new method 'sort' for array objects */object implicitsextends Application {implicitdef arrayWrapper[A : ClassManifest](x: Array[A]) =new {def sort(p: (A, A)=> Boolean) = {        util.Sorting.stableSort(x, p); x      }    }val x = Array(2, 3, 1, 4)  println("x = "+ x.sort((x: Int, y: Int)=> x < y))}

Scala Quick Links

Featured News

User login


will be sent securely

Create new account

Retrieve lost password

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland


[8]ページ先頭

©2009-2026 Movatter.jp