This file contains hidden or 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 int andResult = a & b; | |
| final int orResult = a | b; | |
| final int xorResult = a ^ b; | |
| final int rightShift = a >> 2; | |
| final int leftShift = a << 2; |
This file contains hidden or 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 hidden or 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(a instanceof String){ | |
| final String result = ((String) a).substring(1); | |
| } |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 'package:flutter/material.dart'; | |
| void main() { | |
| runApp( | |
| MaterialApp( | |
| home: Text("Hello, World!") | |
| ) | |
| ); | |
| } |
This file contains hidden or 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 'package:flutter/material.dart'; | |
| void main() { | |
| runApp( | |
| MaterialApp( | |
| home: Padding( | |
| padding: const EdgeInsets.only(top: 24.0), | |
| child: Text("Hello, World") | |
| ) | |
| ) |