J2K: coversion of specially mapped built-in methods + replacing "get" with "[]" where possible
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import java.util.*;
|
||||
|
||||
enum E {
|
||||
A, B, C
|
||||
}
|
||||
|
||||
class A {
|
||||
void foo(List<String> list, Collection<Integer> collection, Map<Integer, Integer> map) {
|
||||
int a = "".length();
|
||||
String b = E.A.name();
|
||||
int c = E.A.ordinal();
|
||||
int d = list.size() + collection.size();
|
||||
int e = map.size();
|
||||
int f = map.keySet().size();
|
||||
int g = map.values().size();
|
||||
int h = map.entrySet().size();
|
||||
}
|
||||
|
||||
void bar(List<String> list) {
|
||||
char c = "a".charAt(0);
|
||||
byte b = new Integer(10).byteValue();
|
||||
int i = new Double(10.1).intValue();
|
||||
float f = new Double(10.1).floatValue();
|
||||
long l = new Double(10.1).longValue();
|
||||
short s = new Double(10.1).shortValue();
|
||||
|
||||
String removed = list.remove(10);
|
||||
Boolean isRemoved = list.remove("a");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
import java.util.*
|
||||
|
||||
internal enum class E {
|
||||
A, B, C
|
||||
}
|
||||
|
||||
internal class A {
|
||||
fun foo(list: List<String>, collection: Collection<Int>, map: Map<Int, Int>) {
|
||||
val a = "".length
|
||||
val b = E.A.name
|
||||
val c = E.A.ordinal
|
||||
val d = list.size + collection.size
|
||||
val e = map.size
|
||||
val f = map.keys.size
|
||||
val g = map.values.size
|
||||
val h = map.entries.size
|
||||
}
|
||||
|
||||
fun bar(list: MutableList<String>) {
|
||||
val c = "a"[0]
|
||||
val b = 10.toByte()
|
||||
val i = 10.1.toInt()
|
||||
val f = 10.1.toFloat()
|
||||
val l = 10.1.toLong()
|
||||
val s = 10.1.toShort()
|
||||
|
||||
val removed = list.removeAt(10)
|
||||
val isRemoved = list.remove("a")
|
||||
}
|
||||
}
|
||||
@@ -25,12 +25,12 @@ internal class A {
|
||||
|
||||
fun normalMethods() {
|
||||
val s = "test string"
|
||||
s.length()
|
||||
s.length
|
||||
s.isEmpty()
|
||||
s.charAt(1)
|
||||
s[1]
|
||||
s.codePointAt(2)
|
||||
s.codePointBefore(2)
|
||||
s.codePointCount(0, s.length())
|
||||
s.codePointCount(0, s.length)
|
||||
s.offsetByCodePoints(0, 4)
|
||||
s.compareTo("test 2")
|
||||
s.concat(" another")
|
||||
|
||||
Reference in New Issue
Block a user