This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Java | |
if(x instanceof Integer){ } | |
final String text = (String) other; | |
if(x >= 0 && x <= 10 ){} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Java | |
final String result; | |
switch (x){ | |
case 0: | |
case 11: | |
result = "0 or 11"; | |
break; | |
case 1: | |
case 2: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Java | |
for (int i = 1; i < 11 ; i++) { } | |
for (int i = 1; i < 11 ; i+=2) { } | |
for (String item : collection) { } | |
for (Map.Entry<String, String> entry: map.entrySet()) { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Java | |
List<Integer> numbers = Arrays.asList(1, 2, 3); | |
Map<Integer, String> map = new HashMap<Integer, String>(); | |
map.put(1, "One"); | |
map.put(2, "Two"); | |
map.put(3, "Three"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun newInstance(startPosition: Int) = MediaPagerFragment().apply { | |
arguments = Bundle().apply { | |
putInt(ARG_START_POSITION, startPosition) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Before | |
public void grantPhonePermission() { | |
// In M+, trying to call a number will trigger a runtime dialog. Make sure | |
// the permission is granted before running this test. | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { | |
getInstrumentation().getUiAutomation().executeShellCommand( | |
"pm grant " + getTargetContext().getPackageName() | |
+ " android.permission.CALL_PHONE"); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const kContacts = const <Contact>[ | |
const Contact( | |
fullName: 'Romain Hoogmoed', | |
email:'romain.hoogmoed@example.com' | |
), | |
const Contact( | |
fullName: 'Emilie Olsen', | |
email:'emilie.olsen@example.com' | |
) | |
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Contact { | |
final String fullName; | |
final String email; | |
const Contact({this.fullName, this.email}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:async'; | |
class Contact { | |
final String fullName; | |
final String email; | |
const Contact({this.fullName, this.email}); | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Contact { | |
final String fullName; | |
final String email; | |
const Contact({this.fullName, this.email}); | |
Contact.fromMap(Map<String, dynamic> map) : | |
fullName = "${map['name']['first']} ${map['name']['last']}", | |
email = map['email']; |