Skip to main content
added 1 character in body
Source Link
138 Aspen
  • 6.6k
  • 1
  • 4
  • 13
  1. Use syntactic sugar and built-in functions to save bytes.

syntactic sugar, e.g.   use /: operator (fold left)

val sum = numbers.foldLeft(0) { (accumulator, element) => accumulator + element }

val sum = (0 /: numbers) { (accumulator, element) => accumulator + element }
  1. Type conversion. 231+.0 instead of 231.toDouble.  231+"" instead of 231.toString

  2. Use Seq instead of Array or List

  3. Rewrite type name and method name.

Rewrite the type name if the type appears very many times.

Use generic parameter instead of external type definition to save more bytes.

/*42 bytes*/
def f(a:String,b:String,c:String,d:String)

/*36 bytes*/
type S=String
def f(a:S,b:S,c:S,d:S)

/*33 bytes*/
def f[S<:String](a:S,b:S,c:S,d:S)

If the method appears very many times, please rewrite the method name.

implicit class V[A](val x:A)extends AnyVal{def Q=x.toSet}
  1. Avoid def return type if possible.   Use def instead of lambda function val f=.   e.g.

    use def f(a:Int)=a+1 instead of val f:(Int=>Int)={a:Int=>a+1} to save bytes.

  2. Avoid unnecessary braces {} ()

  3. Simultaneously initialize multiple variables val r,c=new StringBuilder;

  4. use 0to0 to x-1 instead of 0 until x

  1. Use syntactic sugar and built-in functions to save bytes.

syntactic sugar, e.g.   use /: operator (fold left)

val sum = numbers.foldLeft(0) { (accumulator, element) => accumulator + element }

val sum = (0 /: numbers) { (accumulator, element) => accumulator + element }
  1. Type conversion. 231+.0 instead of 231.toDouble.  231+"" instead of 231.toString

  2. Use Seq instead of Array or List

  3. Rewrite type name and method name.

Rewrite the type name if the type appears very many times.

Use generic parameter instead of external type definition to save more bytes.

/*42 bytes*/
def f(a:String,b:String,c:String,d:String)

/*36 bytes*/
type S=String
def f(a:S,b:S,c:S,d:S)

/*33 bytes*/
def f[S<:String](a:S,b:S,c:S,d:S)

If the method appears very many times, please rewrite the method name.

implicit class V[A](val x:A)extends AnyVal{def Q=x.toSet}
  1. Avoid def return type if possible.   Use def instead of lambda function val f=.   e.g.

    use def f(a:Int)=a+1 instead of val f:(Int=>Int)={a:Int=>a+1} to save bytes.

  2. Avoid unnecessary braces {} ()

  3. Simultaneously initialize multiple variables val r,c=new StringBuilder;

  4. use 0to x-1 instead of 0 until x

  1. Use syntactic sugar and built-in functions to save bytes.

syntactic sugar, e.g.   use /: operator (fold left)

val sum = numbers.foldLeft(0) { (accumulator, element) => accumulator + element }

val sum = (0 /: numbers) { (accumulator, element) => accumulator + element }
  1. Type conversion. 231+.0 instead of 231.toDouble.  231+"" instead of 231.toString

  2. Use Seq instead of Array or List

  3. Rewrite type name and method name.

Rewrite the type name if the type appears very many times.

Use generic parameter instead of external type definition to save more bytes.

/*42 bytes*/
def f(a:String,b:String,c:String,d:String)

/*36 bytes*/
type S=String
def f(a:S,b:S,c:S,d:S)

/*33 bytes*/
def f[S<:String](a:S,b:S,c:S,d:S)

If the method appears very many times, please rewrite the method name.

implicit class V[A](val x:A)extends AnyVal{def Q=x.toSet}
  1. Avoid def return type if possible.   Use def instead of lambda function val f=.   e.g.

    use def f(a:Int)=a+1 instead of val f:(Int=>Int)={a:Int=>a+1} to save bytes.

  2. Avoid unnecessary braces {} ()

  3. Simultaneously initialize multiple variables val r,c=new StringBuilder;

  4. use 0 to x-1 instead of 0 until x

Fixed some typos
Source Link
noodle person
  • 10.3k
  • 1
  • 22
  • 76
  1. Use syntactic sugar and built-in functions to save bytes.

syntactic sugar, e.g.   use /: operator (fold left)

val sum = numbers.foldLeft(0) { (accumulator, element) => accumulator + element }

val sum = (0 /: numbers) { (accumulator, element) => accumulator + element }
  1. Type conversion. 231+.0 instead of 231.toDouble.  231+"" instead of 231.toString

  2. Use Seq instead of Array noror List

  3. Rewrite type name and method name.

Rewrite the type name if the type appears very many times.

Use generic parameter instead of external type definition to save more bytes.

/*42 bytes*/
def f(a:String,b:String,c:String,d:String)

/*36 bytes*/
type S=String
def f(a:S,b:S,c:S,d:S)

/*33 bytse*bytes*/
def f[S<:String](a:S,b:S,c:S,d:S)

If the method appears very many times, please rewrite the method name.

implicit class V[A](val x:A)extends AnyVal{def Q=x.toSet}
  1. Avoid def return type if possible.   Use def instead of lambda function val f=.   e.g.

    use def f(a:Int)=a+1 instead of val f:(Int=>Int)={a:Int=>a+1} to save bytes.

  2. Avoid unnecessary braces {} ()

  3. SimutaneouslySimultaneously initialize multiple variables val r,c=new StringBuilder;

  4. use 0to x-1 instead of 0 until x

  1. Use syntactic sugar and built-in functions to save bytes.

syntactic sugar, e.g.   use /: operator (fold left)

val sum = numbers.foldLeft(0) { (accumulator, element) => accumulator + element }

val sum = (0 /: numbers) { (accumulator, element) => accumulator + element }
  1. Type conversion. 231+.0 instead of 231.toDouble.  231+"" instead of 231.toString

  2. Use Seq instead of Array nor List

  3. Rewrite type name and method name.

Rewrite the type name if the type appears very many times.

Use generic parameter instead of external type definition to save more bytes.

/*42 bytes*/
def f(a:String,b:String,c:String,d:String)

/*36 bytes*/
type S=String
def f(a:S,b:S,c:S,d:S)

/*33 bytse*/
def f[S<:String](a:S,b:S,c:S,d:S)

If the method appears very many times, please rewrite the method name.

implicit class V[A](val x:A)extends AnyVal{def Q=x.toSet}
  1. Avoid def return type if possible.   Use def instead of lambda function val f=.   e.g.

    use def f(a:Int)=a+1 instead of val f:(Int=>Int)={a:Int=>a+1} to save bytes.

  2. Avoid unnecessary braces {} ()

  3. Simutaneously initialize multiple variables val r,c=new StringBuilder;

  4. use 0to x-1 instead of 0 until x

  1. Use syntactic sugar and built-in functions to save bytes.

syntactic sugar, e.g.   use /: operator (fold left)

val sum = numbers.foldLeft(0) { (accumulator, element) => accumulator + element }

val sum = (0 /: numbers) { (accumulator, element) => accumulator + element }
  1. Type conversion. 231+.0 instead of 231.toDouble.  231+"" instead of 231.toString

  2. Use Seq instead of Array or List

  3. Rewrite type name and method name.

Rewrite the type name if the type appears very many times.

Use generic parameter instead of external type definition to save more bytes.

/*42 bytes*/
def f(a:String,b:String,c:String,d:String)

/*36 bytes*/
type S=String
def f(a:S,b:S,c:S,d:S)

/*33 bytes*/
def f[S<:String](a:S,b:S,c:S,d:S)

If the method appears very many times, please rewrite the method name.

implicit class V[A](val x:A)extends AnyVal{def Q=x.toSet}
  1. Avoid def return type if possible.   Use def instead of lambda function val f=.   e.g.

    use def f(a:Int)=a+1 instead of val f:(Int=>Int)={a:Int=>a+1} to save bytes.

  2. Avoid unnecessary braces {} ()

  3. Simultaneously initialize multiple variables val r,c=new StringBuilder;

  4. use 0to x-1 instead of 0 until x

added 136 characters in body
Source Link
138 Aspen
  • 6.6k
  • 1
  • 4
  • 13
  1. Use syntactic sugar and built-in functions to save bytes.

syntactic sugar, e.g.   use /: operator (fold left)

val sum = numbers.foldLeft(0) { (accumulator, element) => accumulator + element }

val sum = (0 /: numbers) { (accumulator, element) => accumulator + element }
  1. Type conversion. 231+.0 instead of 231.toDouble.  231+"" instead of 231.toString

  2. Use Seq instead of Array nor List

  3. Rewrite type name and method name.

Rewrite the type name if the type appears very many times.

Use generic parameter instead of external type definition to save more bytes.

/*42 bytes*/
def f(a:String,b:String,c:String,d:String)

/*36 bytes*/
type S=String
def f(a:S,b:S,c:S,d:S)

/*33 bytse*/
def f[S<:String](a:S,b:S,c:S,d:S)

If the method appears very many times, please rewrite the method name.

implicit class V[A](val x:A)extends AnyVal{def Q=x.toSet}
  1. Avoid def return type if possible.   Use def instead of lambda function val f=.   e.g.

    use def f(a:Int)=a+1 instead of val f:(Int=>Int)={a:Int=>a+1} to save bytes.

  2. Avoid unnecessary braces {} ()

  3. Simutaneously initialize multiple variables val r,c=new StringBuilder;

  4. use 0to x-1 instead of 0 until x

  1. Use syntactic sugar and built-in functions to save bytes.

syntactic sugar, e.g.   use /: operator (fold left)

val sum = numbers.foldLeft(0) { (accumulator, element) => accumulator + element }

val sum = (0 /: numbers) { (accumulator, element) => accumulator + element }
  1. Type conversion. 231+.0 instead of 231.toDouble.  231+"" instead of 231.toString

  2. Use Seq instead of Array nor List

  3. Rewrite type name and method name.

Rewrite the type name if the type appears very many times.

/*42 bytes*/
def f(a:String,b:String,c:String,d:String)

/*36 bytes*/
type S=String
def f(a:S,b:S,c:S,d:S)

If the method appears very many times, please rewrite the method name.

implicit class V[A](val x:A)extends AnyVal{def Q=x.toSet}
  1. Avoid def return type if possible.   Use def instead of lambda function val f=.   e.g.

    use def f(a:Int)=a+1 instead of val f:(Int=>Int)={a:Int=>a+1} to save bytes.

  2. Avoid unnecessary braces {} ()

  3. Simutaneously initialize multiple variables val r,c=new StringBuilder;

  4. use 0to x-1 instead of 0 until x

  1. Use syntactic sugar and built-in functions to save bytes.

syntactic sugar, e.g.   use /: operator (fold left)

val sum = numbers.foldLeft(0) { (accumulator, element) => accumulator + element }

val sum = (0 /: numbers) { (accumulator, element) => accumulator + element }
  1. Type conversion. 231+.0 instead of 231.toDouble.  231+"" instead of 231.toString

  2. Use Seq instead of Array nor List

  3. Rewrite type name and method name.

Rewrite the type name if the type appears very many times.

Use generic parameter instead of external type definition to save more bytes.

/*42 bytes*/
def f(a:String,b:String,c:String,d:String)

/*36 bytes*/
type S=String
def f(a:S,b:S,c:S,d:S)

/*33 bytse*/
def f[S<:String](a:S,b:S,c:S,d:S)

If the method appears very many times, please rewrite the method name.

implicit class V[A](val x:A)extends AnyVal{def Q=x.toSet}
  1. Avoid def return type if possible.   Use def instead of lambda function val f=.   e.g.

    use def f(a:Int)=a+1 instead of val f:(Int=>Int)={a:Int=>a+1} to save bytes.

  2. Avoid unnecessary braces {} ()

  3. Simutaneously initialize multiple variables val r,c=new StringBuilder;

  4. use 0to x-1 instead of 0 until x

added 44 characters in body
Source Link
138 Aspen
  • 6.6k
  • 1
  • 4
  • 13
Loading
Typo
Source Link
The Thonnu
  • 18.3k
  • 3
  • 16
  • 74
Loading
added 40 characters in body
Source Link
138 Aspen
  • 6.6k
  • 1
  • 4
  • 13
Loading
added 40 characters in body
Source Link
138 Aspen
  • 6.6k
  • 1
  • 4
  • 13
Loading
deleted 3 characters in body
Source Link
138 Aspen
  • 6.6k
  • 1
  • 4
  • 13
Loading
added 153 characters in body
Source Link
138 Aspen
  • 6.6k
  • 1
  • 4
  • 13
Loading
Source Link
138 Aspen
  • 6.6k
  • 1
  • 4
  • 13
Loading