Use Option() instead of Some() for object creation.

This commit is contained in:
Felix Ableitner 2015-07-01 19:22:56 +02:00
parent 9654ba0c2a
commit b73e142a73
4 changed files with 6 additions and 6 deletions

View file

@ -89,7 +89,7 @@ class DatabaseTest extends AndroidTestCase {
database.addContact(UserTest.u1)
val contacts = database.getContacts
assertEquals(1, contacts.size)
assertEquals(Some(UserTest.u1), database.getContact(UserTest.u1.address))
assertEquals(Option(UserTest.u1), database.getContact(UserTest.u1.address))
}
def testAddContactCallback(): Unit = {
@ -106,7 +106,7 @@ class DatabaseTest extends AndroidTestCase {
assertTrue(database.getContact(UserTest.u1.address).isEmpty)
val c = database.getContact(UserTest.u2.address)
assertTrue(c.nonEmpty)
assertEquals(Some(UserTest.u2), c)
assertEquals(Option(UserTest.u2), c)
}
}

View file

@ -83,7 +83,7 @@ class MainActivity extends EnsichatActivity {
* Opens a chat fragment for the given device, creating the fragment if needed.
*/
def openChat(address: Address): Unit = {
currentChat = Some(address)
currentChat = Option(address)
getFragmentManager
.beginTransaction()
.detach(contactsFragment)

View file

@ -21,13 +21,13 @@ object CryptoData {
if (keyLength != 0) {
val key = new Array[Byte](keyLength)
b.get(key, 0, keyLength)
Some(key)
Option(key)
}
else None
val remaining = new Array[Byte](b.remaining())
b.get(remaining, 0, b.remaining())
(new CryptoData(Some(signature), key), remaining)
(new CryptoData(Option(signature), key), remaining)
}
}

View file

@ -121,7 +121,7 @@ class Database(context: Context)
Array(address.toString), null, null, null, null)
if (c.getCount != 0) {
c.moveToNext()
val s = Some(new User(new Address(c.getString(c.getColumnIndex("address"))),
val s = Option(new User(new Address(c.getString(c.getColumnIndex("address"))),
c.getString(c.getColumnIndex("name"))))
c.close()
s