Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: src/org/adblockplus/android/StringUtils.java

Issue 29348632: Issue 4260 - Replace Apache Commons Lang classes (Closed)
Left Patch Set: full changeset including rene's comments Created July 26, 2016, 1:38 p.m.
Right Patch Set: two-space indentation Created July 29, 2016, 12:16 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 package org.adblockplus.android; 18 package org.adblockplus.android;
19 19
20 public class StringUtils 20 public class StringUtils
Felix Dahlke 2016/09/12 15:53:28 Might be worth a doc comment that this is supposed
anton 2016/09/13 06:27:14 Actually this class has exactly the same methods s
Felix Dahlke 2016/09/13 08:23:29 Fair enough, let's leave it as is.
anton 2016/09/13 10:39:04 Acknowledged.
21 { 21 {
22 public static boolean isNotEmpty(String value) 22 public static boolean isNotEmpty(String value)
René Jeschke 2016/07/28 11:46:22 We're using two-space indentation. ;-)
anton 2016/07/28 11:48:59 Yes, i know. I've been thinking we can approve the
23 {
24 return value != null && value.length() > 0;
25 }
26
27 public static boolean isEmpty(String value)
28 {
29 return !isNotEmpty(value);
30 }
31
32 public static String join(Object[] array, String separator)
33 {
34 if (array == null)
23 { 35 {
24 return value != null && value.length() > 0; 36 return null;
25 } 37 }
26 38
27 public static boolean isEmpty(String value) 39 StringBuilder sb = new StringBuilder();
40 for (int i = 0; i < array.length; i++)
28 { 41 {
29 return !isNotEmpty(value); 42 String eachValue = array[i].toString();
43 if (i > 0 && separator != null)
44 {
45 sb.append(separator);
46 }
47
48 if (eachValue != null)
Felix Dahlke 2016/09/12 15:53:28 So if the value is null, we'd just print the separ
anton 2016/09/13 06:27:14 There is a difference between null string and empt
Felix Dahlke 2016/09/13 08:23:29 Makes sense, just wanted to make sure that's the i
anton 2016/09/13 10:39:04 Acknowledged.
49 {
50 sb.append(eachValue);
51 }
30 } 52 }
31 53
32 public static String join(Object[] array, String separator) 54 return sb.toString();
33 { 55 }
34 if (array == null)
35 {
36 return null;
37 }
38
39 StringBuilder sb = new StringBuilder();
40 for (int i = 0; i < array.length; i++)
41 {
42 String eachValue = array[i].toString();
43 if (i > 0 && separator != null)
44 {
45 sb.append(separator);
46 }
47
48 if (eachValue != null)
49 {
50 sb.append(eachValue);
51 }
52 }
53
54 return sb.toString();
55 }
56 } 56 }
LEFTRIGHT
« no previous file | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld