| Chunk |
|---|
| Conflicting content |
|---|
*/ package org.codeartisans.java.toolbox; <<<<<<< HEAD import java.io.BufferedReader; import java.io.IOException; import java.io.Reader; import java.io.StringReader; import java.io.StringWriter; ======= import java.util.Arrays; import java.util.Iterator; >>>>>>> 11238a2bf52ccf2d035da1fd358baa99065612c0 import java.util.Map; import java.util.Random; import java.util.regex.Matcher; |
| Solution content |
|---|
*/ package org.codeartisans.java.toolbox; import java.io.BufferedReader; import java.io.IOException; import java.io.Reader; import java.io.StringReader; import java.io.StringWriter; import java.util.Arrays; import java.util.Iterator; import java.util.Map; import java.util.Random; import java.util.regex.Matcher; |
| File |
|---|
| StringUtils.java |
| Developer's decision |
|---|
| Concatenation |
| Kind of conflict |
|---|
| Import |
| Chunk |
|---|
| Conflicting content |
|---|
return array == null || array.length <= 0;
}
<<<<<<< HEAD
public static String toString( Reader input )
throws IOException
{
StringWriter builder = new StringWriter();
IO.copy( input, builder );
return builder.toString();
}
public static String indentTwoSpaces( String input, int level )
{
try {
return indentTwoSpaces( new StringReader( input ), level );
} catch ( IOException ex ) {
throw new RuntimeException( ERROR_STRINGREADER_ON_STRING, ex );
}
}
public static String indentTab( String input, int level )
{
try {
return indentTab( new StringReader( input ), level );
} catch ( IOException ex ) {
throw new RuntimeException( ERROR_STRINGREADER_ON_STRING, ex );
}
}
public static String indent( String input, int level, String tab )
{
try {
return indent( new StringReader( input ), level, tab, EMPTY );
} catch ( IOException ex ) {
throw new RuntimeException( ERROR_STRINGREADER_ON_STRING, ex );
}
}
public static String indent( String input, int level, String tab, String prefix )
{
try {
return indent( new StringReader( input ), level, tab, prefix );
} catch ( IOException ex ) {
throw new RuntimeException( ERROR_STRINGREADER_ON_STRING, ex );
}
}
public static String indentTwoSpaces( Reader input, int level )
throws IOException
{
return indent( input, level, " " );
}
public static String indentTab( Reader input, int level )
throws IOException
{
return indent( input, level, TAB );
}
public static String indent( Reader input, int level, String tab )
throws IOException
{
return indent( input, level, tab, EMPTY );
}
public static String indent( Reader input, int level, String tab, String prefix )
throws IOException
{
final StringBuffer buffer = new StringBuffer();
BufferedReader reader = new BufferedReader( input );
StringBuilder output = new StringBuilder();
try {
String eachLine = reader.readLine();
if ( !isEmpty( eachLine ) ) {
appendIndent( output, level, tab ).append( prefix ).append( eachLine );
while ( ( eachLine = reader.readLine() ) != null ) {
output.append( NEWLINE );
if ( !isEmpty( eachLine ) ) {
appendIndent( output, level, tab ).append( prefix ).append( eachLine );
}
}
}
return output.toString();
} finally {
IO.closeSilently( reader );
}
}
private static StringBuilder appendIndent( StringBuilder output, int level, String tab )
{
for ( int indent = 0; indent < level; indent++ ) {
output.append( tab );
}
return output;
}
public static StringBuffer renderTemplate( final StringBuffer template,
final Map |
| Solution content |
|---|
return array == null || array.length <= 0;
}
public static String toString( Reader input )
throws IOException
{
StringWriter builder = new StringWriter();
IO.copy( input, builder );
return builder.toString();
}
public static String indentTwoSpaces( String input, int level )
{
try {
return indentTwoSpaces( new StringReader( input ), level );
} catch ( IOException ex ) {
throw new RuntimeException( ERROR_STRINGREADER_ON_STRING, ex );
}
}
public static String indentTab( String input, int level )
{
try {
return indentTab( new StringReader( input ), level );
} catch ( IOException ex ) {
throw new RuntimeException( ERROR_STRINGREADER_ON_STRING, ex );
}
}
public static String indent( String input, int level, String tab )
{
try {
return indent( new StringReader( input ), level, tab, EMPTY );
} catch ( IOException ex ) {
throw new RuntimeException( ERROR_STRINGREADER_ON_STRING, ex );
}
}
public static String indent( String input, int level, String tab, String prefix )
{
try {
return indent( new StringReader( input ), level, tab, prefix );
} catch ( IOException ex ) {
throw new RuntimeException( ERROR_STRINGREADER_ON_STRING, ex );
}
}
public static String indentTwoSpaces( Reader input, int level )
throws IOException
{
return indent( input, level, " " );
}
public static String indentTab( Reader input, int level )
throws IOException
{
return indent( input, level, TAB );
}
StringBuilder output = new StringBuilder();
try {
String eachLine = reader.readLine();
if ( !isEmpty( eachLine ) ) {
appendIndent( output, level, tab ).append( prefix ).append( eachLine );
public static String indent( Reader input, int level, String tab )
throws IOException
{
return indent( input, level, tab, EMPTY );
}
public static String indent( Reader input, int level, String tab, String prefix )
throws IOException
{
BufferedReader reader = new BufferedReader( input );
while ( ( eachLine = reader.readLine() ) != null ) {
output.append( NEWLINE );
if ( !isEmpty( eachLine ) ) {
appendIndent( output, level, tab ).append( prefix ).append( eachLine );
}
}
}
return output.toString();
} finally {
IO.closeSilently( reader );
}
}
private static StringBuilder appendIndent( StringBuilder output, int level, String tab )
{
for ( int indent = 0; indent < level; indent++ ) {
output.append( tab );
}
return output;
}
public static String join( String[] strings )
{
return join( Arrays.asList( strings ) );
}
public static String join( String[] strings, String delimiter )
{
return join( Arrays.asList( strings ), delimiter );
}
public static String join( Iterable extends CharSequence> strings )
{
return join( strings, "" );
}
public static String join( Iterable extends CharSequence> strings, String delimiter )
{
int capacity = 0;
int delimLength = delimiter.length();
Iterator extends CharSequence> iter = strings.iterator();
if ( iter.hasNext() ) {
capacity += iter.next().length() + delimLength;
}
StringBuilder buffer = new StringBuilder( capacity );
iter = strings.iterator();
if ( iter.hasNext() ) {
buffer.append( iter.next() );
while ( iter.hasNext() ) {
buffer.append( delimiter );
buffer.append( iter.next() );
}
}
return buffer.toString();
}
public static StringBuffer renderTemplate( StringBuffer template, Map |
| File |
|---|
| StringUtils.java |
| Developer's decision |
|---|
| Combination |
| Kind of conflict |
|---|
| Method declaration |
| Method signature |