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
OptionalInt result = numbers.stream().filter(this::isEven) | |
.mapToInt(this::doubleIt).filter(this::isGreaterThan5) | |
.findFirst(); | |
System.out.println("first number is " + result.getAsInt()); | |
assertThat(result.getAsInt(), equalTo(8)); |
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
numbers = Arrays.asList(new Integer[] { 1, 2, 3, 4, 5, 6 }); | |
numberOperations = 0; | |
private boolean isEven(int n) { | |
System.out.println(numberOperations + " - Is " + n + " even?"); | |
numberOperations++; | |
return n % 2 == 0; | |
} | |
private int doubleIt(int n) { |
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
public static void main(final String[] args) { | |
final String path = args[0]; | |
try (BufferedReader br = new BufferedReader(new FileReader(path))) { | |
String line = br.readLine(); | |
final int rows = Integer.parseInt(line); | |
final Point[] points = new Point[rows]; | |
for (int i = 0; i < rows; i++) { | |
line = br.readLine(); |
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
<?xml version="1.0" encoding="utf-8"?> | |
<resources> | |
<!-- Change these values for your Liferay Portal installation --> | |
<string name="liferay_server">http://WRITE_HERE_YOUR_HOST:8080</string> | |
<integer name="liferay_company_id">WRITE_HERE_YOUR_COMPANY_ID</integer> | |
<integer name="liferay_group_id">WRITE_HERE_YOUR_GROUP_ID</integer> | |
</resources> |
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
public static byte[] decodeSampledBitmapFromResource(String path, int reqWidth, int reqHeight) { | |
// First decode with inJustDecodeBounds=true to check dimensions | |
final BitmapFactory.Options options = new BitmapFactory.Options(); | |
options.inJustDecodeBounds = true; | |
BitmapFactory.decodeFile(path, options); | |
options.inSampleSize = calculateInSampleSize(options, reqWidth, reqHeight); | |
options.inJustDecodeBounds = false; | |
Bitmap bitmap = BitmapFactory.decodeFile(path, options); |
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
double resolution = 200; | |
double points = 72; | |
double ratio = resolution / points; | |
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), drawable); | |
Double width = bitmap.getWidth() / ratio; | |
Double height = bitmap.getHeight() / ratio; |
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
<?xml version="1.0" encoding="utf-8"?> | |
<com.liferay.mobile.screens.viewsets.defaultviews.webcontentdisplay.WebContentDisplayView | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"> | |
<ProgressBar | |
android:id="@+id/liferay_webview_progress" | |
android:layout_width="wrap_content" | |
android:layout_height="wrap_content" |
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
compile 'com.liferay.mobile:liferay-screens:+' |
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
packagingOptions { | |
exclude 'META-INF/LICENSE' | |
exclude 'META-INF/NOTICE' | |
} |
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
<?xml version="1.0" encoding="utf-8"?> | |
<resources> | |
<string name="liferay_server">http://audiencetargeting.liferay.org.es/</string> | |
<string name="liferay_company_id">20155</string> | |
<string name="liferay_group_id">78201</string> | |
</resources> |
OlderNewer