Compare commits

..

41 commits
0.4 ... 0.17

Author SHA1 Message Date
c64a76a8ac Upgraded commons-lang3 lib to 3.13.0. 2023-11-27 04:14:18 +01:00
57fd1de666 Removed unuseful code. 2021-10-14 16:43:17 +02:00
376e594328 Build 0.17.0 2021-10-14 15:55:31 +02:00
bce98b5849 Upgraded commons-lang3 from 3.7 to 3.12. 2021-10-14 15:55:07 +02:00
2a9583de78 Upgraded to Java 17. 2021-10-12 19:29:11 +02:00
f78bb92c5f Build 0.11.4 2021-06-07 03:07:40 +02:00
ab69bc620c Added startsWith*, endsWith* and contains* methods in StringsUtils. 2021-06-07 03:06:29 +02:00
0445919fc2 Added containsNone methods. 2021-02-22 01:31:45 +01:00
b2adaba8ba Fixed deprecated code and copyright years. 2021-01-18 19:43:48 +01:00
d186965f7f Build 0.11.3 2021-01-18 19:36:46 +01:00
a4985cb2b8 Added remove methods and unit tests. 2021-01-18 19:36:21 +01:00
8da21c24c8 Build 0.11.2 2021-01-18 07:04:51 +01:00
565af32f0b Improved writeTo utils methods. 2021-01-18 07:04:09 +01:00
905a808aaa Build 0.11.1 2021-01-15 17:44:23 +01:00
54225f84f6 Fixed mistake in list building. 2021-01-15 17:43:34 +01:00
61d913c3e8 Reviewed code. 2020-10-05 15:22:46 +02:00
4aca746ee0 Added isMatching strings by regexps, and tests. 2020-09-29 18:18:36 +02:00
05c1b543fe Upgraded README file. 2020-09-13 01:11:09 +02:00
c497501bc6 Fixed NullPointerException with IllegalArgumentException. 2020-09-13 00:46:44 +02:00
016eab3417 Updated some copyright year references. 2020-09-13 00:42:43 +02:00
8a56a70946 Build 0.11.0 2020-09-08 17:40:46 +02:00
f9c9760608 Upgraded minor version to 11 for Java migration. 2020-09-08 17:36:03 +02:00
0658c685a1 Upgrade minor version to 11 as symbolic step to Java 11. 2020-08-24 15:39:31 +02:00
56085f105b Added filter and count methods, and test code about. 2020-08-15 03:34:23 +02:00
fbb55f8a7f Migrated to Eclipse 4.16 and Java 11. 2020-08-14 01:15:35 +02:00
164c9a07aa Added toStringSeparatedBy Character methods. 2020-08-14 01:12:31 +02:00
668bb8fbb7 Improved StringList constructors 2020-08-14 01:00:29 +02:00
a3737ddfa1 Improved string array concatenation. 2018-09-22 12:37:47 +02:00
71219fdb70 Added concatenate methods in StringsUtils. 2018-06-13 12:46:35 +02:00
3055a98c66 Cleaned not useful MANIFEST file. 2018-06-04 11:24:02 +02:00
47a626b940 Made a Javadoc review. 2018-06-04 09:34:35 +02:00
39f6c62c96 Build 0.8.2 2018-06-04 09:18:36 +02:00
2c28e9758a Moved unitary tests. 2018-06-04 09:15:50 +02:00
3f28d77fea Added constructors for primitive types. 2018-06-04 09:15:45 +02:00
e6cabe2665 Build 0.8.1 2018-05-30 18:44:44 +02:00
266bd63118 Moved package from fr.devinsy.util to fr.devinsy. 2018-05-30 18:44:25 +02:00
980058604f Build 0.8.0 2018-05-30 14:39:26 +02:00
30238636d8 Updated library jar files. 2018-05-30 09:31:25 +02:00
5a8e2130df Migrated code to Java 8. 2018-05-30 09:31:08 +02:00
2005888197 Migrated and cleaned Eclipse configuration to Java 8. 2018-05-30 09:30:45 +02:00
d18c8ccd88 Init the branch 0.8 for Java 8 migration. 2018-05-30 09:27:40 +02:00
39 changed files with 3383 additions and 1137 deletions

View file

@ -2,17 +2,16 @@
<classpath> <classpath>
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="test"/> <classpathentry kind="src" path="test"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/java-17-openjdk-amd64">
<classpathentry kind="lib" path="lib/commons-lang3-3.1.jar" sourcepath="lib/commons-lang3-3.1-sources.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
<attributes> <attributes>
<attribute name="owner.project.facets" value="java"/> <attribute name="module" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="lib" path="lib/Logs/slf4j-api-1.7.5.jar" sourcepath="lib/Logs/slf4j-api-1.7.5-sources.jar"/>
<classpathentry kind="lib" path="lib/Logs/slf4j-log4j12-1.7.5.jar" sourcepath="lib/Logs/slf4j-log4j12-1.7.5-sources.jar"/>
<classpathentry kind="lib" path="lib/UnitTesting/hamcrest-core-1.3.jar" sourcepath="lib/UnitTesting/hamcrest-core-1.3-sources.jar"/> <classpathentry kind="lib" path="lib/UnitTesting/hamcrest-core-1.3.jar" sourcepath="lib/UnitTesting/hamcrest-core-1.3-sources.jar"/>
<classpathentry kind="lib" path="lib/UnitTesting/junit-4.11.jar" sourcepath="lib/UnitTesting/junit-4.11-sources.jar"/>
<classpathentry kind="lib" path="lib/Logs/log4j-1.2.17.jar" sourcepath="lib/Logs/log4j-1.2.17-source.zip"/> <classpathentry kind="lib" path="lib/Logs/log4j-1.2.17.jar" sourcepath="lib/Logs/log4j-1.2.17-source.zip"/>
<classpathentry kind="lib" path="lib/UnitTesting/junit-4.12.jar" sourcepath="lib/UnitTesting/junit-4.12-sources.jar"/>
<classpathentry kind="lib" path="lib/Logs/slf4j-api-1.7.25.jar" sourcepath="lib/Logs/slf4j-api-1.7.25-sources.jar"/>
<classpathentry kind="lib" path="lib/Logs/slf4j-log4j12-1.7.25.jar" sourcepath="lib/Logs/slf4j-log4j12-1.7.25-sources.jar"/>
<classpathentry kind="lib" path="lib/commons-lang3-3.13.0.jar" sourcepath="lib/commons-lang3-3.13.0-sources.jar"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>
</classpath> </classpath>

View file

@ -10,16 +10,25 @@ org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes= org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes= org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=17
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.compliance=17
org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6 org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=17
org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false
org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns=false
org.eclipse.jdt.core.formatter.align_with_spaces=false
org.eclipse.jdt.core.formatter.alignment_for_additive_operator=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
@ -27,25 +36,41 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_c
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_assignment=0 org.eclipse.jdt.core.formatter.alignment_for_assignment=0
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
org.eclipse.jdt.core.formatter.alignment_for_compact_loops=16
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80 org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression_chain=0
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=49 org.eclipse.jdt.core.formatter.alignment_for_enum_constants=49
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16 org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header=0
org.eclipse.jdt.core.formatter.alignment_for_logical_operator=16
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0 org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_module_statements=16
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16 org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator=16
org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references=0
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_record_components=16
org.eclipse.jdt.core.formatter.alignment_for_relational_operator=0
org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80 org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
org.eclipse.jdt.core.formatter.alignment_for_shift_operator=0
org.eclipse.jdt.core.formatter.alignment_for_string_concatenation=16
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_record_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16 org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_type_arguments=0
org.eclipse.jdt.core.formatter.alignment_for_type_parameters=0
org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
org.eclipse.jdt.core.formatter.blank_lines_after_last_class_body_declaration=0
org.eclipse.jdt.core.formatter.blank_lines_after_package=1 org.eclipse.jdt.core.formatter.blank_lines_after_package=1
org.eclipse.jdt.core.formatter.blank_lines_before_abstract_method=1
org.eclipse.jdt.core.formatter.blank_lines_before_field=0 org.eclipse.jdt.core.formatter.blank_lines_before_field=0
org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
@ -54,6 +79,7 @@ org.eclipse.jdt.core.formatter.blank_lines_before_method=1
org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
org.eclipse.jdt.core.formatter.blank_lines_before_package=0 org.eclipse.jdt.core.formatter.blank_lines_before_package=0
org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
org.eclipse.jdt.core.formatter.blank_lines_between_statement_group_in_switch=0
org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=next_line org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=next_line
org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=next_line org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=next_line
@ -63,11 +89,17 @@ org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=next_line
org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=next_line org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=next_line
org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=next_line org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=next_line
org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=next_line org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=next_line
org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=next_line org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=next_line
org.eclipse.jdt.core.formatter.brace_position_for_record_constructor=next_line
org.eclipse.jdt.core.formatter.brace_position_for_record_declaration=next_line
org.eclipse.jdt.core.formatter.brace_position_for_switch=next_line org.eclipse.jdt.core.formatter.brace_position_for_switch=next_line
org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=next_line org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=next_line
org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped=false
org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions=false
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position=false
org.eclipse.jdt.core.formatter.comment.format_block_comments=false org.eclipse.jdt.core.formatter.comment.format_block_comments=false
org.eclipse.jdt.core.formatter.comment.format_header=false org.eclipse.jdt.core.formatter.comment.format_header=false
org.eclipse.jdt.core.formatter.comment.format_html=true org.eclipse.jdt.core.formatter.comment.format_html=true
@ -76,9 +108,11 @@ org.eclipse.jdt.core.formatter.comment.format_line_comments=true
org.eclipse.jdt.core.formatter.comment.format_source_code=true org.eclipse.jdt.core.formatter.comment.format_source_code=true
org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
org.eclipse.jdt.core.formatter.comment.indent_root_tags=true org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
org.eclipse.jdt.core.formatter.comment.indent_tag_description=false
org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
org.eclipse.jdt.core.formatter.comment.insert_new_line_between_different_tags=do not insert
org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
org.eclipse.jdt.core.formatter.comment.line_length=80 org.eclipse.jdt.core.formatter.comment.line_length=120
org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
@ -92,6 +126,7 @@ org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_record_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=false org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=false
org.eclipse.jdt.core.formatter.indent_empty_lines=false org.eclipse.jdt.core.formatter.indent_empty_lines=false
@ -100,6 +135,7 @@ org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
org.eclipse.jdt.core.formatter.indentation.size=4 org.eclipse.jdt.core.formatter.indentation.size=4
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
@ -108,6 +144,7 @@ org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert
org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
@ -121,11 +158,14 @@ org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_after_additive_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_case=insert
org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default=insert
org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
@ -151,10 +191,16 @@ org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arg
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_record_components=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_switch_case_expressions=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert
org.eclipse.jdt.core.formatter.insert_space_after_logical_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_not_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
@ -171,6 +217,7 @@ org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not ins
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_record_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
@ -179,13 +226,19 @@ org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_relational_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
org.eclipse.jdt.core.formatter.insert_space_after_shift_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert
org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case=insert
org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default=insert
org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
@ -202,6 +255,7 @@ org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not in
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_record_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
@ -228,10 +282,15 @@ org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_ar
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_record_components=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_switch_case_expressions=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert
org.eclipse.jdt.core.formatter.insert_space_before_logical_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
@ -243,6 +302,8 @@ org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_constructor=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_record_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
@ -258,6 +319,7 @@ org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_record_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
@ -268,9 +330,12 @@ org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not inser
org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_relational_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_shift_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation=insert
org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
@ -282,20 +347,62 @@ org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_decla
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.join_lines_in_comments=true org.eclipse.jdt.core.formatter.join_lines_in_comments=true
org.eclipse.jdt.core.formatter.join_wrapped_lines=true org.eclipse.jdt.core.formatter.join_wrapped_lines=true
org.eclipse.jdt.core.formatter.keep_annotation_declaration_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_anonymous_type_declaration_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_code_block_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
org.eclipse.jdt.core.formatter.keep_enum_constant_declaration_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_enum_declaration_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_if_then_body_block_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
org.eclipse.jdt.core.formatter.keep_lambda_body_block_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_loop_body_block_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_method_body_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_record_constructor_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_record_declaration_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line=false
org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line=false
org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line=false
org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line=false
org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line=one_line_never
org.eclipse.jdt.core.formatter.lineSplit=200 org.eclipse.jdt.core.formatter.lineSplit=200
org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
org.eclipse.jdt.core.formatter.number_of_blank_lines_after_code_block=0
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_code_block=0
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_code_block=0
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_method_body=0
org.eclipse.jdt.core.formatter.number_of_blank_lines_before_code_block=0
org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_record_declaration=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement=common_lines
org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause=common_lines
org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
org.eclipse.jdt.core.formatter.tabulation.char=tab org.eclipse.jdt.core.formatter.tabulation.char=tab
org.eclipse.jdt.core.formatter.tabulation.size=4 org.eclipse.jdt.core.formatter.tabulation.size=4
org.eclipse.jdt.core.formatter.text_block_indentation=0
org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_on_off_tags=false
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true
org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false
org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true
org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true
org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true
org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator=true
org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
org.eclipse.jdt.core.formatter.wrap_before_relational_operator=true
org.eclipse.jdt.core.formatter.wrap_before_shift_operator=true
org.eclipse.jdt.core.formatter.wrap_before_string_concatenation=true
org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter

View file

@ -11,27 +11,38 @@ cleanup.always_use_blocks=true
cleanup.always_use_parentheses_in_expressions=false cleanup.always_use_parentheses_in_expressions=false
cleanup.always_use_this_for_non_static_field_access=true cleanup.always_use_this_for_non_static_field_access=true
cleanup.always_use_this_for_non_static_method_access=false cleanup.always_use_this_for_non_static_method_access=false
cleanup.convert_functional_interfaces=false
cleanup.convert_to_enhanced_for_loop=false cleanup.convert_to_enhanced_for_loop=false
cleanup.convert_to_enhanced_for_loop_if_loop_var_used=false
cleanup.correct_indentation=false cleanup.correct_indentation=false
cleanup.format_source_code=true cleanup.format_source_code=true
cleanup.format_source_code_changes_only=false cleanup.format_source_code_changes_only=false
cleanup.insert_inferred_type_arguments=false
cleanup.lazy_logical_operator=false
cleanup.make_local_variable_final=false cleanup.make_local_variable_final=false
cleanup.make_parameters_final=true cleanup.make_parameters_final=true
cleanup.make_private_fields_final=false cleanup.make_private_fields_final=false
cleanup.make_type_abstract_if_missing_method=false cleanup.make_type_abstract_if_missing_method=false
cleanup.make_variable_declarations_final=true cleanup.make_variable_declarations_final=true
cleanup.merge_conditional_blocks=false
cleanup.never_use_blocks=false cleanup.never_use_blocks=false
cleanup.never_use_parentheses_in_expressions=true cleanup.never_use_parentheses_in_expressions=true
cleanup.number_suffix=false
cleanup.organize_imports=false cleanup.organize_imports=false
cleanup.push_down_negation=false
cleanup.qualify_static_field_accesses_with_declaring_class=false cleanup.qualify_static_field_accesses_with_declaring_class=false
cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
cleanup.qualify_static_member_accesses_with_declaring_class=true cleanup.qualify_static_member_accesses_with_declaring_class=true
cleanup.qualify_static_method_accesses_with_declaring_class=false cleanup.qualify_static_method_accesses_with_declaring_class=false
cleanup.remove_private_constructors=true cleanup.remove_private_constructors=true
cleanup.remove_redundant_modifiers=false
cleanup.remove_redundant_semicolons=false
cleanup.remove_redundant_type_arguments=false
cleanup.remove_trailing_whitespaces=true cleanup.remove_trailing_whitespaces=true
cleanup.remove_trailing_whitespaces_all=true cleanup.remove_trailing_whitespaces_all=true
cleanup.remove_trailing_whitespaces_ignore_empty=false cleanup.remove_trailing_whitespaces_ignore_empty=false
cleanup.remove_unnecessary_array_creation=false
cleanup.remove_unnecessary_casts=true cleanup.remove_unnecessary_casts=true
cleanup.remove_unnecessary_nls_tags=true cleanup.remove_unnecessary_nls_tags=true
cleanup.remove_unused_imports=true cleanup.remove_unused_imports=true
@ -40,21 +51,31 @@ cleanup.remove_unused_private_fields=true
cleanup.remove_unused_private_members=false cleanup.remove_unused_private_members=false
cleanup.remove_unused_private_methods=true cleanup.remove_unused_private_methods=true
cleanup.remove_unused_private_types=true cleanup.remove_unused_private_types=true
cleanup.simplify_lambda_expression_and_method_ref=false
cleanup.sort_members=true cleanup.sort_members=true
cleanup.sort_members_all=false cleanup.sort_members_all=false
cleanup.use_anonymous_class_creation=false
cleanup.use_autoboxing=false
cleanup.use_blocks=true cleanup.use_blocks=true
cleanup.use_blocks_only_for_return_and_throw=false cleanup.use_blocks_only_for_return_and_throw=false
cleanup.use_directly_map_method=false
cleanup.use_lambda=true
cleanup.use_parentheses_in_expressions=false cleanup.use_parentheses_in_expressions=false
cleanup.use_this_for_non_static_field_access=true cleanup.use_this_for_non_static_field_access=true
cleanup.use_this_for_non_static_field_access_only_if_necessary=false cleanup.use_this_for_non_static_field_access_only_if_necessary=false
cleanup.use_this_for_non_static_method_access=false cleanup.use_this_for_non_static_method_access=false
cleanup.use_this_for_non_static_method_access_only_if_necessary=true cleanup.use_this_for_non_static_method_access_only_if_necessary=true
cleanup.use_unboxing=false
cleanup.use_var=false
cleanup_profile=_Devinsy-strings cleanup_profile=_Devinsy-strings
cleanup_settings_version=2 cleanup_settings_version=2
eclipse.preferences.version=1 eclipse.preferences.version=1
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
formatter_profile=_Devinsy-strings formatter_profile=_Devinsy-strings
formatter_settings_version=12 formatter_settings_version=19
jautodoc.cleanup.add_header=false
jautodoc.cleanup.javadoc=false
jautodoc.cleanup.replace_header=false
org.eclipse.jdt.ui.exception.name=exception org.eclipse.jdt.ui.exception.name=exception
org.eclipse.jdt.ui.gettersetter.use.is=true org.eclipse.jdt.ui.gettersetter.use.is=true
org.eclipse.jdt.ui.keywordthis=false org.eclipse.jdt.ui.keywordthis=false

View file

@ -1,8 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<faceted-project> <faceted-project>
<runtime name="Apache Tomcat v7.0"/>
<fixed facet="jst.java"/> <fixed facet="jst.java"/>
<fixed facet="jst.utility"/> <fixed facet="jst.utility"/>
<installed facet="jst.java" version="6.0"/>
<installed facet="jst.utility" version="1.0"/> <installed facet="jst.utility" version="1.0"/>
<installed facet="jst.java" version="17"/>
</faceted-project> </faceted-project>

View file

@ -13,8 +13,8 @@ This software is released under the GNU LGPL.
## Requirements ## Requirements
- Java 1.6 - Java 11
- Eclipse Kepler - Eclipse 4.16 (202006).
## Context ## Context
Several useful Java classes. Several useful Java classes.

View file

@ -1,3 +1,3 @@
#Build Number for ANT. Do not edit! #Build Number for ANT. Do not edit!
#Thu Dec 28 05:08:48 CET 2017 #Thu Oct 14 15:55:30 CEST 2021
build.number=5 build.number=1

View file

@ -1,3 +1,3 @@
product.name=devinsy-strings product.name=devinsy-strings
product.revision.major=0 product.revision.major=0
product.revision.minor=4 product.revision.minor=17

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -1,3 +0,0 @@
Manifest-Version: 1.0
Class-Path:

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2013-2017 Christian Pierre MOMON * Copyright (C) 2013-2018 Christian Pierre MOMON
* *
* This file is part of Devinsy-strings. * This file is part of Devinsy-strings.
* *
@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with Devinsy-strings. If not, see <http://www.gnu.org/licenses/> * along with Devinsy-strings. If not, see <http://www.gnu.org/licenses/>
*/ */
package fr.devinsy.util.strings; package fr.devinsy.strings;
import java.util.Comparator; import java.util.Comparator;
@ -71,8 +71,8 @@ public class StringLengthComparator implements Comparator<String>
* *
* <pre> * <pre>
* compare(null, null) = 0 * compare(null, null) = 0
* compare(null, bravo) < 0 * compare(null, bravo) &lt; 0
* compare(alpha, null) > 0 * compare(alpha, null) &gt; 0
* compare(alpha, bravo) = alpha.compareTo(bravo) * compare(alpha, bravo) = alpha.compareTo(bravo)
* </pre> * </pre>
* *

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2008-2010,2013-2015,2017 Christian Pierre MOMON * Copyright (C) 2008-2021 Christian Pierre MOMON
* *
* This file is part of Devinsy-strings. * This file is part of Devinsy-strings.
* *
@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with Devinsy-strings. If not, see <http://www.gnu.org/licenses/> * along with Devinsy-strings. If not, see <http://www.gnu.org/licenses/>
*/ */
package fr.devinsy.util.strings; package fr.devinsy.strings;
import java.io.IOException; import java.io.IOException;
import java.text.Collator; import java.text.Collator;
@ -25,14 +25,15 @@ import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.Iterator; import java.util.Iterator;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
/** /**
* The <code>StringList</code> class is a collection of String objects with * The <code>StringList</code> class is a collection of String objects with specific methods. It makes possible to build
* specific methods. It makes possible to build a string without any copy. The * a string without any copy. The goal is to optimize the building of strings where they are lot of concatenation
* goal is to optimize the building of strings where they are lot of * action.
* concatenation action.
* *
*/ */
public class StringList extends ArrayList<String> implements CharSequence, Appendable public class StringList extends ArrayList<String> implements CharSequence, Appendable
@ -42,8 +43,7 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
public static final String LINE_SEPARATOR = "\n"; public static final String LINE_SEPARATOR = "\n";
/** /**
* Constructs an empty list with an initial capacity of ten (see ArrayList * Constructs an empty list with an initial capacity of ten (see ArrayList constructor).
* constructor).
*/ */
public StringList() public StringList()
{ {
@ -51,10 +51,53 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
} }
/** /**
* Constructs a list of string of the specified collection, in the order * Instantiates a new string list from an array of boolean.
* they are returned by the collection's iterator.
* *
* @param source * @param source
* the source
*/
public StringList(final boolean[] source)
{
super();
if (source != null)
{
ensureCapacity(source.length);
for (boolean value : source)
{
add(String.valueOf(value));
}
}
}
/**
* Instantiates a new string list from an array of char.
*
* @param source
* the source
*/
public StringList(final char[] source)
{
super();
if (source != null)
{
ensureCapacity(source.length);
for (char value : source)
{
add(String.valueOf(value));
}
}
}
/**
* Constructs a list of string of the specified collection, in the order they are returned by the collection's
* iterator.
*
* @param source
* the source
*/ */
public StringList(final Collection<String> source) public StringList(final Collection<String> source)
{ {
@ -62,10 +105,8 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
if (source != null) if (source != null)
{ {
//
ensureCapacity(source.size()); ensureCapacity(source.size());
//
for (String string : source) for (String string : source)
{ {
this.add(string); this.add(string);
@ -73,20 +114,106 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
} }
} }
/**
* Instantiates a new string list from an array of double.
*
* @param source
* the source
*/
public StringList(final double[] source)
{
super();
if (source != null)
{
ensureCapacity(source.length);
for (double value : source)
{
add(String.valueOf(value));
}
}
}
/**
* Instantiates a new string list from an array of float.
*
* @param source
* the source
*/
public StringList(final float[] source)
{
super();
if (source != null)
{
ensureCapacity(source.length);
for (float value : source)
{
add(String.valueOf(value));
}
}
}
/** /**
* Constructs an empty list with the specified initial capacity. * Constructs an empty list with the specified initial capacity.
* *
* @param initialCapacity * @param initialCapacity
* the initial capacity
*/ */
public StringList(final int initialCapacity) public StringList(final int initialCapacity)
{ {
super(initialCapacity); super(initialCapacity);
} }
/**
* Instantiates a new string list from an array of int.
*
* @param source
* the source
*/
public StringList(final int[] source)
{
super();
if (source != null)
{
ensureCapacity(source.length);
for (int value : source)
{
add(String.valueOf(value));
}
}
}
/**
* Instantiates a new string list from an array of long.
*
* @param source
* the source
*/
public StringList(final long[] source)
{
super();
if (source != null)
{
ensureCapacity(source.length);
for (long value : source)
{
add(String.valueOf(value));
}
}
}
/** /**
* Constructs a list of string from an Object array. * Constructs a list of string from an Object array.
* *
* @param source * @param source
* the source
*/ */
public StringList(final Object... source) public StringList(final Object... source)
{ {
@ -96,7 +223,38 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
{ {
ensureCapacity(source.length); ensureCapacity(source.length);
append(source); for (Object value : source)
{
if (value == null)
{
add(null);
}
else
{
add(value.toString());
}
}
}
}
/**
* Instantiates a new string list from an array of short.
*
* @param source
* the source
*/
public StringList(final short[] source)
{
super();
if (source != null)
{
ensureCapacity(source.length);
for (short value : source)
{
add(String.valueOf(value));
}
} }
} }
@ -104,6 +262,7 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
* Constructs a list of string from a string array. * Constructs a list of string from a string array.
* *
* @param source * @param source
* the source
*/ */
public StringList(final String... source) public StringList(final String... source)
{ {
@ -122,36 +281,8 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
} }
} }
/** /* (non-Javadoc)
* Appends the string of the array argument to this string list. * @see java.lang.Appendable#append(char)
*
* @param strings
* @return
*/
public StringList append(final boolean... values)
{
StringList result;
if (values != null)
{
for (boolean value : values)
{
this.append(value);
}
}
result = this;
//
return result;
}
/**
* Appends the string representation of the char argument to this string
* list.
*
* @param character
* @return
*/ */
@Override @Override
public StringList append(final char character) public StringList append(final char character)
@ -205,11 +336,11 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
} }
/** /**
* Appends the string of the specified collection, in the order they are * Appends the string of the specified collection, in the order they are returned by the collection's iterator.
* returned by the collection's iterator.
* *
* @param strings * @param strings
* @return * the strings
* @return the string list
*/ */
public StringList append(final Collection<String> strings) public StringList append(final Collection<String> strings)
{ {
@ -230,11 +361,11 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
} }
/** /**
* Appends the string representation of the double argument to this string * Appends the string representation of the double argument to this string list.
* list.
* *
* @param value * @param value
* @return * the value
* @return the string list
*/ */
public StringList append(final double value) public StringList append(final double value)
{ {
@ -247,11 +378,11 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
} }
/** /**
* Appends the string representation of the int argument to this string * Appends the string representation of the int argument to this string list.
* list.
* *
* @param value * @param value
* @return * the value
* @return the string list
*/ */
public StringList append(final int value) public StringList append(final int value)
{ {
@ -264,11 +395,11 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
} }
/** /**
* Appends the string representation of the long argument to this string * Appends the string representation of the long argument to this string list.
* list.
* *
* @param value * @param value
* @return * the value
* @return the string list
*/ */
public StringList append(final long value) public StringList append(final long value)
{ {
@ -281,35 +412,11 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
} }
/** /**
* Appends the string of the array argument to this string list. * Appends the string representation of the int argument to this string list.
*
* @param values
* @return
*/
public StringList append(final Long... values)
{
StringList result;
if (values != null)
{
for (Long value : values)
{
this.append(value);
}
}
result = this;
//
return result;
}
/**
* Appends the string representation of the int argument to this string
* list.
* *
* @param value * @param value
* @return * the value
* @return the string list
*/ */
public StringList append(final Object value) public StringList append(final Object value)
{ {
@ -329,8 +436,9 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
/** /**
* Appends the string of the array argument to this string list. * Appends the string of the array argument to this string list.
* *
* @param strings * @param values
* @return * the values
* @return the string list
*/ */
public StringList append(final Object... values) public StringList append(final Object... values)
{ {
@ -351,11 +459,11 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
} }
/** /**
* Appends the string representation of the long argument to this string * Appends the string representation of the long argument to this string list.
* list.
* *
* @param value * @param value
* @return * the value
* @return the string list
*/ */
public StringList append(final short value) public StringList append(final short value)
{ {
@ -370,10 +478,9 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
/** /**
* Appends the string argument to this string list. * Appends the string argument to this string list.
* *
* Check null parameter before add.
*
* @param string * @param string
* @return * the string
* @return the string list
*/ */
public StringList append(final String string) public StringList append(final String string)
{ {
@ -394,7 +501,8 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
* Appends the string of the array argument to this string list. * Appends the string of the array argument to this string list.
* *
* @param strings * @param strings
* @return * the strings
* @return the string list
*/ */
public StringList append(final String... strings) public StringList append(final String... strings)
{ {
@ -417,7 +525,7 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
/** /**
* Appends a break line to this string list. * Appends a break line to this string list.
* *
* @return * @return the string list
*/ */
public StringList appendln() public StringList appendln()
{ {
@ -432,11 +540,11 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
} }
/** /**
* Appends the string representation of the char argument to this string * Appends the string representation of the char argument to this string list, then append a break line too.
* list, then append a break line too.
* *
* @param character * @param character
* @return * the character
* @return the string list
*/ */
public StringList appendln(final char character) public StringList appendln(final char character)
{ {
@ -449,7 +557,8 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
} }
/** /**
* Appendln. * Appends the string of the specified collection, in the order they are returned by the collection's iterator. Then
* append a return line.
* *
* @param string * @param string
* the string * the string
@ -466,7 +575,7 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
} }
/** /**
* Appendln. * Appends the string representation of the double argument to this string list.
* *
* @param value * @param value
* the value * the value
@ -483,7 +592,7 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
} }
/** /**
* Appendln. * Appends the string representation of the int argument to this string list.
* *
* @param value * @param value
* the value * the value
@ -500,7 +609,7 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
} }
/** /**
* Appendln. * Appends the string representation of the long argument to this string list.
* *
* @param value * @param value
* the value * the value
@ -520,7 +629,8 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
* Appends the string of the array argument to this string list. * Appends the string of the array argument to this string list.
* *
* @param values * @param values
* @return * the values
* @return the string list
*/ */
public StringList appendln(final Object... values) public StringList appendln(final Object... values)
{ {
@ -535,7 +645,7 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
} }
/** /**
* Appendln. * Appends the string representation of the int argument to this string list.
* *
* @param value * @param value
* the value * the value
@ -552,7 +662,7 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
} }
/** /**
* Appendln. * Appends the string representation of the long argument to this string list.
* *
* @param value * @param value
* the value * the value
@ -569,7 +679,7 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
} }
/** /**
* Appendln. * Appends the string argument to this string list.
* *
* @param string * @param string
* the string * the string
@ -586,7 +696,7 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
} }
/** /**
* Appendln. * Appends the string of the array argument to this string list.
* *
* @param strings * @param strings
* the strings * the strings
@ -639,8 +749,7 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
} }
/** /**
* Deep copy and shallow copy have no sense about a list of immutable * Deep copy and shallow copy have no sense about a list of immutable objects.
* objects.
* *
* @return the string list * @return the string list
*/ */
@ -1031,6 +1140,144 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
return result; return result;
} }
/**
* Count blank strings.
*
* @return the blank string count.
*/
public int countBlankStrings()
{
int result;
result = 0;
for (String string : this)
{
if (StringUtils.isBlank(string))
{
result += 1;
}
}
//
return result;
}
/**
* Count not blank strings.
*
* @return the not blank string count.
*/
public int countNotBlankStrings()
{
int result;
result = 0;
for (String string : this)
{
if (StringUtils.isNotBlank(string))
{
result += 1;
}
}
//
return result;
}
/**
* Count strings matching a regex.
*
* @param regex
* the regex
* @return the string count matching the regex.
*/
public int countStrings(final String regex)
{
int result;
result = 0;
if (regex != null)
{
Pattern compiledPattern = Pattern.compile(regex);
for (String string : this)
{
if (string != null)
{
Matcher matcher = compiledPattern.matcher(string);
if (matcher.matches())
{
result += 1;
}
}
}
}
//
return result;
}
/**
* Filter the strings matching a regex.
*
* @param regex
* the regex to match.
* @return the string list matching the regex
*/
public StringList filter(final String regex)
{
StringList result;
result = new StringList(this.size());
if (regex != null)
{
Pattern compiledPattern = Pattern.compile(regex);
for (String string : this)
{
if (string != null)
{
Matcher matcher = compiledPattern.matcher(string);
if (matcher.matches())
{
result.add(string);
}
}
}
}
result.trimToSize();
//
return result;
}
/**
* Filter blank strings.
*
* @return the not Blank string list
*/
public StringList filterBlankStrings()
{
StringList result;
result = new StringList(this.size());
for (String string : this)
{
if (StringUtils.isNotBlank(string))
{
result.add(string);
}
}
//
return result;
}
/** /**
* Gets the by index. * Gets the by index.
* *
@ -1071,8 +1318,9 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
} }
/** /**
* Gets the last.
* *
* @return * @return the last
*/ */
public String getLast() public String getLast()
{ {
@ -1477,8 +1725,7 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
} }
/** /**
* Returns the length of the string list concatenation. Null strings are * Returns the length of the string list concatenation. Null strings are ignored.
* ignored.
* *
* @return the int * @return the int
*/ */
@ -1500,9 +1747,8 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
} }
/** /**
* Merge all strings of the list into in single string. At the end of * Merge all strings of the list into in single string. At the end of operation, the new string is the first of the
* operation, the new string is the first of the list and the size list is * list and the size list is 1.
* 1.
* *
* @return the string list * @return the string list
*/ */
@ -1521,6 +1767,59 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
return result; return result;
} }
/**
* Removes the first.
*
* @return the string list
*/
public StringList removeFirst()
{
StringList result;
if (!isEmpty())
{
this.remove(0);
}
result = this;
//
return result;
}
/**
* Removes the first.
*
* @param count
* the count
* @return the string list
*/
public StringList removeFirst(final int count)
{
StringList result;
int counting;
if (count < 0)
{
counting = 0;
}
else if (count <= size())
{
counting = count;
}
else
{
counting = size();
}
removeRange(0, counting);
result = this;
//
return result;
}
/** /**
* Removes the last element of the list. * Removes the last element of the list.
* *
@ -1530,7 +1829,7 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
{ {
StringList result; StringList result;
if (this.size() > 0) if (!isEmpty())
{ {
this.remove(this.size() - 1); this.remove(this.size() - 1);
} }
@ -1541,6 +1840,47 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
return result; return result;
} }
/**
* Removes the last.
*
* @param count
* the count
* @return the string list
*/
public StringList removeLast(final int count)
{
StringList result;
int counting;
if (count < 0)
{
counting = 0;
}
else
{
counting = count;
}
boolean ended = false;
while (!ended)
{
if ((counting == 0) || (isEmpty()))
{
ended = true;
}
else
{
this.remove(this.size() - 1);
counting -= 1;
}
}
result = this;
//
return result;
}
/** /**
* Extends the list copying the last element a number of time. * Extends the list copying the last element a number of time.
* *
@ -1626,7 +1966,7 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
{ {
StringList result; StringList result;
Collections.sort(this, Collator.getInstance()); sort(Collator.getInstance());
// //
result = this; result = this;
@ -1638,13 +1978,15 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
/** /**
* Sorts this list. * Sorts this list.
* *
* @return This List. * @param comparator
* the comparator
* @return this string list
*/ */
public StringList sort(final Comparator<String> comparator) public StringList sortBy(final Comparator<? super String> comparator)
{ {
StringList result; StringList result;
Collections.sort(this, comparator); sort(comparator);
// //
result = this; result = this;
@ -1688,9 +2030,9 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
/** /**
* Extracts a substring from this list. * Extracts a substring from this list.
* *
* @param start * @param beginIndex
* The first character of the substring. * The first character of the substring.
* @param end * @param endIndex
* The last character of the substring. * The last character of the substring.
* *
* @return The sublist targeted. * @return The sublist targeted.
@ -1816,7 +2158,7 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
buffer.append(separator); buffer.append(separator);
} }
if (separator != null) if ((separator != null) && (!isEmpty()))
{ {
buffer.removeLast(); buffer.removeLast();
} }
@ -1830,8 +2172,7 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
} }
/** /**
* Returns an array containing all of the strings in this list in proper * Returns an array containing all of the strings in this list in proper sequence (from first to last element).
* sequence (from first to last element).
* *
* @return the string[] * @return the string[]
*/ */
@ -1851,9 +2192,33 @@ public class StringList extends ArrayList<String> implements CharSequence, Appen
} }
/** /**
* Returns a string containing the concatenation of the strings of this * Returns a string containing the concatenation of the strings of this list. Between each string of this list, a
* list. Between each string of this list, a separator argument string is * separator argument string is concatenated too.
* concatenated too. *
* @param separator
* the separator
* @return the string
*/
public String toStringSeparatedBy(final Character separator)
{
String result;
if (separator == null)
{
result = toStringSeparatedBy("");
}
else
{
result = toStringSeparatedBy("" + separator);
}
//
return result;
}
/**
* Returns a string containing the concatenation of the strings of this list. Between each string of this list, a
* separator argument string is concatenated too.
* *
* @param separator * @param separator
* the separator * the separator

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2014-2015,2017 Christian Pierre MOMON * Copyright (C) 2014-2015,2017-2018 Christian Pierre MOMON
* *
* This file is part of Devinsy-strings. * This file is part of Devinsy-strings.
* *
@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with Devinsy-strings. If not, see <http://www.gnu.org/licenses/> * along with Devinsy-strings. If not, see <http://www.gnu.org/licenses/>
*/ */
package fr.devinsy.util.strings; package fr.devinsy.strings;
import java.util.Iterator; import java.util.Iterator;

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2013-2015,2017 Christian Pierre MOMON * Copyright (C) 2013-2015,2017-2018 Christian Pierre MOMON
* *
* This file is part of Devinsy-strings. * This file is part of Devinsy-strings.
* *
@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with Devinsy-strings. If not, see <http://www.gnu.org/licenses/> * along with Devinsy-strings. If not, see <http://www.gnu.org/licenses/>
*/ */
package fr.devinsy.util.strings; package fr.devinsy.strings;
/** /**
* This class manages a char position in a StringList object. * This class manages a char position in a StringList object.

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2013-2015,2017 Christian Pierre MOMON * Copyright (C) 2013-2020 Christian Pierre MOMON
* *
* This file is part of Devinsy-strings. * This file is part of Devinsy-strings.
* *
@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with Devinsy-strings. If not, see <http://www.gnu.org/licenses/> * along with Devinsy-strings. If not, see <http://www.gnu.org/licenses/>
*/ */
package fr.devinsy.util.strings; package fr.devinsy.strings;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
@ -57,7 +57,7 @@ public class StringListInputStream extends InputStream
{ {
if (source == null) if (source == null)
{ {
throw new NullPointerException("source is null."); throw new IllegalArgumentException("source is null.");
} }
else else
{ {

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2013-2017 Christian Pierre MOMON * Copyright (C) 2013-2021 Christian Pierre MOMON
* *
* This file is part of Devinsy-strings. * This file is part of Devinsy-strings.
* *
@ -16,9 +16,8 @@
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with Devinsy-strings. If not, see <http://www.gnu.org/licenses/> * along with Devinsy-strings. If not, see <http://www.gnu.org/licenses/>
*/ */
package fr.devinsy.util.strings; package fr.devinsy.strings;
import java.io.BufferedReader;
import java.io.IOException; import java.io.IOException;
import java.io.Reader; import java.io.Reader;
@ -60,8 +59,6 @@ public class StringListReader extends Reader
{ {
int result; int result;
BufferedReader a;
if ((off < 0) || (off > cbuf.length) || (len < 0) || ((off + len) > cbuf.length) || ((off + len) < 0)) if ((off < 0) || (off > cbuf.length) || (len < 0) || ((off + len) > cbuf.length) || ((off + len) < 0))
{ {
throw new IndexOutOfBoundsException(); throw new IndexOutOfBoundsException();

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2013-2017 Christian Pierre MOMON * Copyright (C) 2013-2020 Christian Pierre MOMON
* *
* This file is part of Devinsy-strings. * This file is part of Devinsy-strings.
* *
@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with Devinsy-strings. If not, see <http://www.gnu.org/licenses/> * along with Devinsy-strings. If not, see <http://www.gnu.org/licenses/>
*/ */
package fr.devinsy.util.strings; package fr.devinsy.strings;
import java.io.IOException; import java.io.IOException;
import java.io.Writer; import java.io.Writer;
@ -57,7 +57,7 @@ public class StringListWriter extends Writer
{ {
if (target == null) if (target == null)
{ {
throw new NullPointerException("target is null."); throw new IllegalArgumentException("target is null.");
} }
else else
{ {

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2014-2017 Christian Pierre MOMON * Copyright (C) 2014-2018 Christian Pierre MOMON
* *
* This file is part of Devinsy-strings. * This file is part of Devinsy-strings.
* *
@ -16,15 +16,14 @@
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with Devinsy-strings. If not, see <http://www.gnu.org/licenses/> * along with Devinsy-strings. If not, see <http://www.gnu.org/licenses/>
*/ */
package fr.devinsy.util.strings; package fr.devinsy.strings;
import java.util.Collection; import java.util.Collection;
import java.util.HashSet; import java.util.HashSet;
/** /**
* This class is a set of String objects with specific methods. It makes * This class is a set of String objects with specific methods. It makes possible to build a string without any copy.
* possible to build a string without any copy. The goal is to make easier the * The goal is to make easier the use of set of strings.
* use of set of strings.
*/ */
public class StringSet extends HashSet<String> public class StringSet extends HashSet<String>
{ {
@ -39,8 +38,8 @@ public class StringSet extends HashSet<String>
} }
/** /**
* Constructs a list of string of the specified collection, in the order * Constructs a list of string of the specified collection, in the order they are returned by the collection's
* they are returned by the collection's iterator. * iterator.
* *
* @param source * @param source
* the source * the source
@ -82,7 +81,6 @@ public class StringSet extends HashSet<String>
if (source != null) if (source != null)
{ {
//
for (String string : source) for (String string : source)
{ {
this.add(string); this.add(string);
@ -102,7 +100,6 @@ public class StringSet extends HashSet<String>
if (source != null) if (source != null)
{ {
//
for (String string : source) for (String string : source)
{ {
this.add(string); this.add(string);
@ -122,15 +119,13 @@ public class StringSet extends HashSet<String>
{ {
boolean result; boolean result;
if (string != null) if (string == null)
{ {
// result = false;
result = super.add(string);
} }
else else
{ {
// result = super.add(string);
result = false;
} }
// //
@ -163,8 +158,7 @@ public class StringSet extends HashSet<String>
} }
/** /**
* Deep copy and shallow copy have no sense about a list of immutable * Deep copy and shallow copy have no sense about a list of immutable objects.
* objects.
* *
* @return the string set * @return the string set
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2008-2010,2013-2016,2017 Christian Pierre MOMON * Copyright (C) 2008-2020 Christian Pierre MOMON
* *
* This file is part of Devinsy-strings. * This file is part of Devinsy-strings.
* *
@ -16,7 +16,7 @@
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with Devinsy-strings. If not, see <http://www.gnu.org/licenses/> * along with Devinsy-strings. If not, see <http://www.gnu.org/licenses/>
*/ */
package fr.devinsy.util.strings; package fr.devinsy.strings;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.File; import java.io.File;
@ -54,8 +54,8 @@ public class StringsUtils
/** /**
* Capitalize. * Capitalize.
* *
* @param sourceStringUtils * @param source
* .lo the source * the source
*/ */
public static void capitalize(final StringList source) public static void capitalize(final StringList source)
{ {
@ -85,6 +85,40 @@ public class StringsUtils
} }
} }
/**
* Concatenates a string list.
*
* @param source
* the source
* @return the concatenate of source strings.
*/
public static String concatenate(final Collection<String> source)
{
String result;
result = new StringList(source).toString();
//
return result;
}
/**
* Concatenates strings.
*
* @param source
* the source
* @return the concatenate of source strings.
*/
public static String concatenate(final String... source)
{
String result;
result = new StringList(source).toString();
//
return result;
}
/** /**
* Builds a string concatenating many times a source string. * Builds a string concatenating many times a source string.
* *
@ -117,29 +151,86 @@ public class StringsUtils
{ {
boolean result; boolean result;
boolean ended = false; if ((token == null) || (strings == null))
int index = 0;
result = false;
while (!ended)
{ {
if (index < strings.length) result = false;
}
else
{
boolean ended = false;
int index = 0;
result = false;
while (!ended)
{ {
String current = strings[index]; if (index < strings.length)
if (StringUtils.contains(token, current))
{ {
ended = true; String current = strings[index];
result = true;
if (StringUtils.contains(token, current))
{
ended = true;
result = true;
}
else
{
index += 1;
}
} }
else else
{ {
index += 1; ended = true;
result = false;
} }
} }
else }
//
return result;
}
/**
* Contains any.
*
* @param token
* the token
* @param strings
* the strings
* @return true, if successful
*/
public static boolean containsAny(final String token, final StringList strings)
{
boolean result;
if ((token == null) || (strings == null))
{
result = false;
}
else
{
boolean ended = false;
int index = 0;
result = false;
while (!ended)
{ {
ended = true; if (index < strings.size())
result = false; {
String current = strings.get(index);
if (StringUtils.contains(token, current))
{
ended = true;
result = true;
}
else
{
index += 1;
}
}
else
{
ended = true;
result = false;
}
} }
} }
@ -160,29 +251,86 @@ public class StringsUtils
{ {
boolean result; boolean result;
boolean ended = false; if ((token == null) || (strings == null))
int index = 0;
result = false;
while (!ended)
{ {
if (index < strings.length) result = false;
}
else
{
boolean ended = false;
int index = 0;
result = false;
while (!ended)
{ {
String current = strings[index]; if (index < strings.length)
if (StringUtils.containsIgnoreCase(token, current))
{ {
ended = true; String current = strings[index];
result = true;
if (StringUtils.containsIgnoreCase(token, current))
{
ended = true;
result = true;
}
else
{
index += 1;
}
} }
else else
{ {
index += 1; ended = true;
result = false;
} }
} }
else }
//
return result;
}
/**
* Contains any ignore case.
*
* @param token
* the token
* @param strings
* the strings
* @return true, if successful
*/
public static boolean containsAnyIgnoreCase(final String token, final StringList strings)
{
boolean result;
if ((token == null) || (strings == null))
{
result = false;
}
else
{
boolean ended = false;
int index = 0;
result = false;
while (!ended)
{ {
ended = true; if (index < strings.size())
result = false; {
String current = strings.get(index);
if (StringUtils.containsIgnoreCase(token, current))
{
ended = true;
result = true;
}
else
{
index += 1;
}
}
else
{
ended = true;
result = false;
}
} }
} }
@ -294,6 +442,44 @@ public class StringsUtils
return result; return result;
} }
/**
* Contains none.
*
* @param token
* the token
* @param strings
* the strings
* @return true, if successful
*/
public static boolean containsNone(final String token, final String... strings)
{
boolean result;
result = !containsAny(token, strings);
//
return result;
}
/**
* Contains none ignore case.
*
* @param token
* the token
* @param strings
* the strings
* @return true, if successful
*/
public static boolean containsNoneIgnoreCase(final String token, final String... strings)
{
boolean result;
result = !containsAnyIgnoreCase(token, strings);
//
return result;
}
/** /**
* Contains null. * Contains null.
* *
@ -346,6 +532,179 @@ public class StringsUtils
return result; return result;
} }
/**
* Count blank strings.
*
* @param source
* the string list to compute.
* @return the blank string count.
*/
public static int countBlankStrings(final StringList source)
{
int result;
if (source == null)
{
result = 0;
}
else
{
result = source.countBlankStrings();
}
//
return result;
}
/**
* Count not blank strings.
*
* @param source
* the string list to compute.
* @return the not blank string count.
*/
public static int countNotBlankStrings(final StringList source)
{
int result;
if (source == null)
{
result = 0;
}
else
{
result = source.countNotBlankStrings();
}
//
return result;
}
/**
* Count strings matching a regex.
*
* @param source
* the string list to compute
* @param regex
* the regex
* @return the string count matching the regex.
*/
public static int countStrings(final StringList source, final String regex)
{
int result;
if (source == null)
{
result = 0;
}
else
{
result = source.countStrings(regex);
}
//
return result;
}
/**
* Ends with any.
*
* @param token
* the token
* @param strings
* the strings
* @return true, if successful
*/
public static boolean endsWithAny(final String token, final StringList strings)
{
boolean result;
if ((token == null) || (strings == null))
{
result = false;
}
else
{
boolean ended = false;
int index = 0;
result = false;
while (!ended)
{
if (index < strings.size())
{
String current = strings.get(index);
if (StringUtils.endsWith(token, current))
{
ended = true;
result = true;
}
else
{
index += 1;
}
}
else
{
ended = true;
result = false;
}
}
}
//
return result;
}
/**
* Ends with any ignore case.
*
* @param token
* the token
* @param strings
* the strings
* @return true, if successful
*/
public static boolean endsWithAnyIgnoreCase(final String token, final StringList strings)
{
boolean result;
if ((token == null) || (strings == null))
{
result = false;
}
else
{
boolean ended = false;
int index = 0;
result = false;
while (!ended)
{
if (index < strings.size())
{
String current = strings.get(index);
if (StringUtils.endsWithIgnoreCase(token, current))
{
ended = true;
result = true;
}
else
{
index += 1;
}
}
else
{
ended = true;
result = false;
}
}
}
//
return result;
}
/** /**
* Checks if is contained. * Checks if is contained.
* *
@ -384,6 +743,56 @@ public class StringsUtils
return result; return result;
} }
/**
* Filter the strings matching a regex.
*
* @param source
* the string list to compute.
* @param regex
* the regex to match.
* @return the string list matching the regex
*/
public static StringList filter(final StringList source, final String regex)
{
StringList result;
if (source == null)
{
result = new StringList();
}
else
{
result = source.filter(regex);
}
//
return result;
}
/**
* Filter blank strings.
*
* @param source
* the string list to compute.
* @return the not Blank string list
*/
public static StringList filterBlankStrings(final StringList source)
{
StringList result;
if (source == null)
{
result = new StringList();
}
else
{
result = source.filterBlankStrings();
}
//
return result;
}
/** /**
* Find longest. * Find longest.
* *
@ -632,6 +1041,7 @@ public class StringsUtils
* *
* @param source * @param source
* the source * the source
* @return true, if is blank
*/ */
public static boolean isBlank(final Collection<String> source) public static boolean isBlank(final Collection<String> source)
{ {
@ -713,6 +1123,88 @@ public class StringsUtils
return result; return result;
} }
/**
* Checks if is matching.
*
* @param args
* the args
* @param regexps
* the regexps
* @return true, if is matching
*/
public static boolean isMatching(final String[] args, final String... regexps)
{
boolean result;
result = isMatching(new StringList(args), regexps);
//
return result;
}
/**
* Checks if is matching.
*
* @param args
* the args
* @param regexps
* the regexps
* @return true, if is matching
*/
public static boolean isMatching(final StringList args, final String... regexps)
{
boolean result;
if (((args == null) || (args.size() == 0)) && ((regexps == null) || (regexps.length == 0)))
{
result = true;
}
else if (((args == null) || (args.size() == 0)) && ((regexps != null) && (regexps.length != 0)))
{
result = false;
}
else if (((args != null) && (args.size() != 0)) && ((regexps == null) || (regexps.length == 0)))
{
result = false;
}
else if (args.size() != regexps.length)
{
result = false;
}
else
{
boolean ended = false;
int index = 0;
result = false;
while (!ended)
{
if (index < args.size())
{
String arg = args.get(index);
String regexp = regexps[index];
if (arg.matches(regexp))
{
index += 1;
}
else
{
ended = true;
result = false;
}
}
else
{
ended = true;
result = true;
}
}
}
//
return result;
}
/** /**
* Load. * Load.
* *
@ -910,7 +1402,7 @@ public class StringsUtils
} }
/** /**
* Save. * Save string of the list as lines.
* *
* @param file * @param file
* the file * the file
@ -959,6 +1451,106 @@ public class StringsUtils
} }
} }
/**
* Starts with any.
*
* @param token
* the token
* @param strings
* the strings
* @return true, if successful
*/
public static boolean startsWithAny(final String token, final StringList strings)
{
boolean result;
if ((token == null) || (strings == null))
{
result = false;
}
else
{
boolean ended = false;
int index = 0;
result = false;
while (!ended)
{
if (index < strings.size())
{
String current = strings.get(index);
if (StringUtils.startsWith(token, current))
{
ended = true;
result = true;
}
else
{
index += 1;
}
}
else
{
ended = true;
result = false;
}
}
}
//
return result;
}
/**
* Starts with any ignore case.
*
* @param token
* the token
* @param strings
* the strings
* @return true, if successful
*/
public static boolean startsWithAnyIgnoreCase(final String token, final StringList strings)
{
boolean result;
if ((token == null) || (strings == null))
{
result = false;
}
else
{
boolean ended = false;
int index = 0;
result = false;
while (!ended)
{
if (index < strings.size())
{
String current = strings.get(index);
if (StringUtils.startsWithIgnoreCase(token, current))
{
ended = true;
result = true;
}
else
{
index += 1;
}
}
else
{
ended = true;
result = false;
}
}
}
//
return result;
}
/** /**
* Swap case. * Swap case.
* *
@ -1001,7 +1593,7 @@ public class StringsUtils
* *
* @return A string concatenation of the argument. * @return A string concatenation of the argument.
*/ */
public static String toString(final String[] source) public static String toString(final String... source)
{ {
String result; String result;
@ -1393,8 +1985,8 @@ public class StringsUtils
* *
* @param source * @param source
* the source * the source
* @return If argument is null then returns an empty string, otherwise * @return If argument is null then returns an empty string, otherwise returns a string concatenation of the
* returns a string concatenation of the argument. * argument.
*/ */
public static String toStringNotNull(final String[] source) public static String toStringNotNull(final String[] source)
{ {
@ -1463,6 +2055,32 @@ public class StringsUtils
return result; return result;
} }
/**
* To string separated by.
*
* @param source
* the source
* @param separator
* the separator
* @return the string
*/
public static String toStringSeparatedBy(final StringList source, final Character separator)
{
String result;
if (source == null)
{
result = null;
}
else
{
result = source.toStringSeparatedBy(separator);
}
//
return result;
}
/** /**
* To string separated by. * To string separated by.
* *
@ -1908,12 +2526,14 @@ public class StringsUtils
/** /**
* Writes the strings of this list into a {@code PrintWriter}. * Writes the strings of this list into a {@code PrintWriter}.
* *
* @param source
* the source
* @param out * @param out
* The {@code PrintWriter} where to write. * The {@code PrintWriter} where to write.
* @throws IOException * @throws IOException
* Signals that an I/O exception has occurred. * Signals that an I/O exception has occurred.
*/ */
public static void writeTo(final StringList source, final java.io.PrintWriter out) throws IOException public static void writeTo(final java.io.PrintWriter out, final StringList source) throws IOException
{ {
if (source != null) if (source != null)
{ {
@ -1927,12 +2547,14 @@ public class StringsUtils
/** /**
* Writes the strings of this list into a {@code Writer}. * Writes the strings of this list into a {@code Writer}.
* *
* @param source
* the source
* @param out * @param out
* The {@code Writer} where to write. * The {@code Writer} where to write.
* @throws IOException * @throws IOException
* Signals that an I/O exception has occurred. * Signals that an I/O exception has occurred.
*/ */
public static void writeTo(final StringList source, final java.io.Writer out) throws IOException public static void writeTo(final java.io.Writer out, final StringList source) throws IOException
{ {
if (source != null) if (source != null)
{ {
@ -1942,4 +2564,40 @@ public class StringsUtils
} }
} }
} }
/**
* Save.
*
* @param file
* the file
* @param source
* the source
* @throws UnsupportedEncodingException
* the unsupported encoding exception
* @throws FileNotFoundException
* the file not found exception
*/
public static void writeToFile(final File file, final StringList source) throws UnsupportedEncodingException, FileNotFoundException
{
PrintWriter out = null;
try
{
out = new PrintWriter(new OutputStreamWriter(new FileOutputStream(file), DEFAULT_CHARSET_NAME));
if (source != null)
{
for (String string : source)
{
out.print(string);
}
}
}
finally
{
if (out != null)
{
out.close();
}
}
}
} }

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2017 Christian Pierre MOMON * Copyright (C) 2017-2021 Christian Pierre MOMON
* *
* This file is part of Devinsy-strings. * This file is part of Devinsy-strings.
* *
@ -16,20 +16,19 @@
* You should have received a copy of the GNU Lesser General Public License * You should have received a copy of the GNU Lesser General Public License
* along with Devinsy-strings. If not, see <http://www.gnu.org/licenses/> * along with Devinsy-strings. If not, see <http://www.gnu.org/licenses/>
*/ */
package fr.devinsy.util.strings.demo; package fr.devinsy.strings.demo;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import fr.devinsy.util.strings.StringList; import fr.devinsy.strings.StringList;
import fr.devinsy.util.strings.StringsUtils; import fr.devinsy.strings.StringsUtils;
/** /**
* The Class Demo. * The Class Demo.
*/ */
public class StringsDemo public class StringsDemo
{ {
/** /**
* The main method. * The main method.
* *
@ -59,14 +58,14 @@ public class StringsDemo
strings.appendln("========== DEMO #2;"); strings.appendln("========== DEMO #2;");
strings.appendln(); strings.appendln();
strings.appendln("Easy to concatenate different types."); strings.appendln("Easy to concatenate different types.");
strings.append("Boolean: ").append(true).append(" ").appendln(new Boolean(false)); strings.append("Boolean: ").append(true).append(" ").appendln(Boolean.valueOf(false));
strings.append("Char: ").append('e').append(" ").appendln(new Character('e')); strings.append("Char: ").append('e').append(" ").appendln(Character.valueOf('e'));
strings.append("Byte : ").append((byte) 5).append(" ").appendln(new Byte((byte) 5)); strings.append("Byte : ").append((byte) 5).append(" ").appendln(Byte.valueOf((byte) 5));
strings.append("Short: ").append((short) 55).append(" ").appendln(new Short((short) 55)); strings.append("Short: ").append((short) 55).append(" ").appendln(Short.valueOf((short) 55));
strings.append("Integer: ").append(555).append(" ").appendln(new Integer(555)); strings.append("Integer: ").append(555).append(" ").appendln(Integer.valueOf(555));
strings.append("Long: ").append(5555L).append(" ").appendln(new Long(5555)); strings.append("Long: ").append(5555L).append(" ").appendln(Long.valueOf(5555));
strings.append("Float: ").append((float) 5555.5).append(" ").appendln(new Float(5555.5)); strings.append("Float: ").append((float) 5555.5).append(" ").appendln(Float.valueOf((float) 5555.5));
strings.append("Double: ").append(5555.55).append(" ").appendln(new Double(5555.55)); strings.append("Double: ").append(5555.55).append(" ").appendln(Double.valueOf(5555.55));
strings.append("String: ").append("abcde").append(" ").appendln(new String("abcde")); strings.append("String: ").append("abcde").append(" ").appendln(new String("abcde"));
strings.append("Object: ").appendln(new Date()); strings.append("Object: ").appendln(new Date());
strings.append("Array of booleans: ").appendln(StringsUtils.toStringList(new boolean[] { true, false, true })); strings.append("Array of booleans: ").appendln(StringsUtils.toStringList(new boolean[] { true, false, true }));
@ -110,7 +109,7 @@ public class StringsDemo
strings.appendln("========== DEMO #4;"); strings.appendln("========== DEMO #4;");
strings.appendln(); strings.appendln();
strings.appendln("Advanced features."); strings.appendln("Advanced features.");
strings.append("Boolean: ").append(true).append(" ").appendln(new Boolean(false)); strings.append("Boolean: ").append(true).append(" ").appendln(Boolean.valueOf(false));
System.out.println(strings.toString()); System.out.println(strings.toString());
} }
@ -122,7 +121,7 @@ public class StringsDemo
strings.appendln("========== DEMO #5;"); strings.appendln("========== DEMO #5;");
strings.appendln(); strings.appendln();
strings.appendln("Funny features."); strings.appendln("Funny features.");
strings.append("Boolean: ").append(true).append(" ").appendln(new Boolean(false)); strings.append("Boolean: ").append(true).append(" ").appendln(Boolean.valueOf(false));
System.out.println(strings.toString()); System.out.println(strings.toString());
} }

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,700 @@
/*
* Copyright (C) 2013-2020 Christian Pierre MOMON
*
* This file is part of Devinsy-strings.
*
* Devinsy-strings is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Devinsy-strings is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Devinsy-strings. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.strings;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
/**
* The Class StringsUtilsTest.
*
* @author Christian Pierre MOMON (christian.momon@devinsy.fr)
*/
public class StringsUtilsTest
{
public final org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(StringsUtilsTest.class);
/**
* Before.
*/
@Before
public void before()
{
BasicConfigurator.configure();
Logger.getRootLogger().setLevel(Level.ERROR);
}
/**
* Test contains any 01.
*/
@Test
public void testContainsAny01()
{
Assert.assertTrue(StringsUtils.containsAny("abc", "aaa", "bbb", "abc"));
Assert.assertFalse(StringsUtils.containsAny("abc", "aaa", "bbb", "aBc"));
Assert.assertTrue(StringsUtils.containsAny("abc", new StringList("aaa", "bbb", "abc")));
Assert.assertFalse(StringsUtils.containsAny("abc", new StringList("aaa", "bbb", "aBc")));
}
/**
* Test contains any ignore case 01.
*/
@Test
public void testContainsAnyIgnoreCatse01()
{
Assert.assertTrue(StringsUtils.containsAnyIgnoreCase("abc", "aaa", "bbb", "abc"));
Assert.assertTrue(StringsUtils.containsAnyIgnoreCase("abc", "aaa", "bbb", "aBc"));
Assert.assertFalse(StringsUtils.containsAnyIgnoreCase("abc", "aaa", "bbb", "ccc"));
Assert.assertTrue(StringsUtils.containsAnyIgnoreCase("abc", new StringList("aaa", "bbb", "abc")));
Assert.assertTrue(StringsUtils.containsAnyIgnoreCase("abc", new StringList("aaa", "bbb", "aBc")));
Assert.assertFalse(StringsUtils.containsAnyIgnoreCase("abc", new StringList("aaa", "bbb", "ccc")));
}
/**
* Test contains blank 01.
*/
@Test
public void testContainsBlank01()
{
Assert.assertFalse(StringsUtils.containsBlank((Collection<String>) null));
Assert.assertFalse(StringsUtils.containsBlank(new StringList("aaa", "bbb", "ccc")));
Assert.assertTrue(StringsUtils.containsBlank(new StringList("aaa", null, "ccc")));
Assert.assertTrue(StringsUtils.containsBlank(new StringList("aaa", "", "ccc")));
Assert.assertTrue(StringsUtils.containsBlank(new StringList("aaa", " ", "ccc")));
}
/**
* Test contains blank 02.
*/
@Test
public void testContainsBlank02()
{
Assert.assertFalse(StringsUtils.containsBlank((String[]) null));
Assert.assertFalse(StringsUtils.containsBlank("aaa", "bbb", "ccc"));
Assert.assertTrue(StringsUtils.containsBlank("aaa", null, "ccc"));
Assert.assertTrue(StringsUtils.containsBlank("aaa", "", "ccc"));
Assert.assertTrue(StringsUtils.containsBlank("aaa", " ", "ccc"));
}
/**
* Test contains blank 03.
*/
@Test
public void testContainsBlank03()
{
Assert.assertFalse(StringsUtils.containsBlank((ArrayList<String>) null));
ArrayList<String> source = new ArrayList<String>();
source.add("aaa");
source.add("bbb");
source.add("ccc");
Assert.assertFalse(StringsUtils.containsBlank(source));
source.set(1, null);
Assert.assertTrue(StringsUtils.containsBlank(source));
source.set(1, "");
Assert.assertTrue(StringsUtils.containsBlank(source));
source.set(1, " ");
Assert.assertTrue(StringsUtils.containsBlank(source));
}
/**
* Test contains empty 01.
*/
@Test
public void testContainsEmpty01()
{
Assert.assertFalse(StringsUtils.containsEmpty((Collection<String>) null));
Assert.assertFalse(StringsUtils.containsEmpty(new StringList("aaa", "bbb", "ccc")));
Assert.assertTrue(StringsUtils.containsEmpty(new StringList("aaa", null, "ccc")));
Assert.assertTrue(StringsUtils.containsEmpty(new StringList("aaa", "", "ccc")));
}
/**
* Test contains empty 02.
*/
@Test
public void testContainsEmpty02()
{
Assert.assertFalse(StringsUtils.containsEmpty((String[]) null));
Assert.assertFalse(StringsUtils.containsEmpty("aaa", "bbb", "ccc"));
Assert.assertTrue(StringsUtils.containsEmpty("aaa", null, "ccc"));
Assert.assertTrue(StringsUtils.containsEmpty("aaa", "", "ccc"));
}
/**
* Test contains empty 03.
*/
@Test
public void testContainsEmpty03()
{
Assert.assertFalse(StringsUtils.containsEmpty((ArrayList<String>) null));
ArrayList<String> source = new ArrayList<String>();
source.add("aaa");
source.add("bbb");
source.add("ccc");
Assert.assertFalse(StringsUtils.containsEmpty(source));
source.set(1, null);
Assert.assertTrue(StringsUtils.containsEmpty(source));
source.set(1, "");
Assert.assertTrue(StringsUtils.containsEmpty(source));
}
/**
* Test contains null 01.
*/
@Test
public void testContainsNull01()
{
Assert.assertFalse(StringsUtils.containsNull((Collection<String>) null));
Assert.assertFalse(StringsUtils.containsNull(new StringList("aaa", "bbb", "ccc")));
Assert.assertTrue(StringsUtils.containsNull(new StringList("aaa", null, "ccc")));
}
/**
* Test contains null 02.
*/
@Test
public void testContainsNull02()
{
Assert.assertFalse(StringsUtils.containsNull((String[]) null));
Assert.assertFalse(StringsUtils.containsNull("aaa", "bbb", "ccc"));
Assert.assertTrue(StringsUtils.containsNull("aaa", null, "ccc"));
}
/**
* Test contains null 03.
*/
@Test
public void testContainsNull03()
{
Assert.assertFalse(StringsUtils.containsNull((ArrayList<String>) null));
ArrayList<String> source = new ArrayList<String>();
source.add("aaa");
source.add("bbb");
source.add("ccc");
Assert.assertFalse(StringsUtils.containsNull(source));
source.set(1, null);
Assert.assertTrue(StringsUtils.containsNull(source));
}
/**
* Test count blank strings.
*/
@Test
public void testCountBlankStrings()
{
//
this.logger.debug("===== test starting...");
{
StringList source = new StringList();
Assert.assertEquals(0, StringsUtils.countBlankStrings(source));
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
Assert.assertEquals(0, StringsUtils.countBlankStrings(source));
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
source.set(1, null);
source.set(4, null);
Assert.assertEquals(2, StringsUtils.countBlankStrings(source));
}
//
this.logger.debug("===== test done.");
}
/**
* Test count blank strings.
*/
@Test
public void testCountNotBlankStrings()
{
//
this.logger.debug("===== test starting...");
{
StringList source = new StringList();
Assert.assertEquals(0, StringsUtils.countNotBlankStrings(source));
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
Assert.assertEquals(5, StringsUtils.countNotBlankStrings(source));
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
source.set(1, null);
source.set(4, null);
Assert.assertEquals(3, StringsUtils.countNotBlankStrings(source));
}
//
this.logger.debug("===== test done.");
}
/**
* Test count blank strings.
*/
@Test
public void testCountStrings()
{
//
this.logger.debug("===== test starting...");
{
StringList source = new StringList();
Assert.assertEquals(0, StringsUtils.countStrings(source, null));
}
{
StringList source = new StringList();
Assert.assertEquals(0, StringsUtils.countStrings(source, "a*"));
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
Assert.assertEquals(0, StringsUtils.countStrings(source, null));
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
Assert.assertEquals(5, StringsUtils.countStrings(source, ".*\\d.*"));
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
source.set(1, null);
source.set(4, null);
Assert.assertEquals(0, StringsUtils.countStrings(source, null));
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
source.set(1, null);
source.set(4, null);
Assert.assertEquals(3, StringsUtils.countStrings(source, ".*\\d.*"));
}
//
this.logger.debug("===== test done.");
}
/**
* Test ends with any 01.
*/
@Test
public void testEndsWithAny01()
{
Assert.assertTrue(StringsUtils.endsWithAny("abc", new StringList("aa", "bb", "bc")));
Assert.assertFalse(StringsUtils.endsWithAny("abc", new StringList("aa", "bb", "Bc")));
}
/**
* Test contains any ignore case 01.
*/
@Test
public void testEndsWithAnyIgnoreCatse01()
{
Assert.assertTrue(StringsUtils.endsWithAnyIgnoreCase("abc", new StringList("aa", "bb", "bc")));
Assert.assertTrue(StringsUtils.endsWithAnyIgnoreCase("abc", new StringList("aa", "bb", "Bc")));
Assert.assertFalse(StringsUtils.endsWithAnyIgnoreCase("abc", new StringList("aa", "bb", "cc")));
}
@Test
public void testEqualsAny01()
{
Assert.assertTrue(StringsUtils.equalsAny("abc", "aaa", "bbb", "abc"));
Assert.assertFalse(StringsUtils.equalsAny("abc", "aaa", "bbb", "aBc"));
}
@Test
public void testEqualsAnyIgnoreCase01()
{
Assert.assertTrue(StringsUtils.equalsAnyIgnoreCase("abc", "aaa", "bbb", "abc"));
Assert.assertTrue(StringsUtils.equalsAnyIgnoreCase("abc", "aaa", "bbb", "aBc"));
}
/**
* Test filter.
*/
@Test
public void testFilter()
{
//
this.logger.debug("===== test starting...");
{
StringList source = new StringList();
Assert.assertEquals(0, StringsUtils.filter(source, null).size());
}
{
StringList source = new StringList();
Assert.assertEquals(0, StringsUtils.filter(source, "a*").size());
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
Assert.assertEquals(0, StringsUtils.filter(source, null).size());
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
Assert.assertEquals(5, StringsUtils.filter(source, ".*\\d.*").size());
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
source.set(1, null);
source.set(4, null);
Assert.assertEquals(0, StringsUtils.filter(source, null).size());
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
source.set(1, null);
source.set(4, null);
Assert.assertEquals(3, StringsUtils.filter(source, ".*\\d.*").size());
}
//
this.logger.debug("===== test done.");
}
/**
* Test filter blank strings.
*/
@Test
public void testFilterBlankStrings()
{
//
this.logger.debug("===== test starting...");
{
StringList source = new StringList();
Assert.assertEquals(0, StringsUtils.filterBlankStrings(source).size());
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
Assert.assertEquals(5, StringsUtils.filterBlankStrings(source).size());
}
{
StringList source = new StringList();
source.append("1aaa").append("2bbb").append("3ccc").append("4ddd").append("5eee");
source.set(1, null);
source.set(4, null);
Assert.assertEquals(3, StringsUtils.filterBlankStrings(source).size());
}
//
this.logger.debug("===== test done.");
}
/**
* Test find smallest 01.
*/
@Test
public void testFindSmallest01()
{
// TODO
Assert.assertFalse(StringsUtils.containsNull((ArrayList<String>) null));
ArrayList<String> source = new ArrayList<String>();
source.add("aaa");
source.add("bbb");
source.add("ccc");
Assert.assertFalse(StringsUtils.containsNull(source));
source.set(1, null);
Assert.assertTrue(StringsUtils.containsNull(source));
}
/**
* Test is matching 01.
*
* @throws IOException
* Signals that an I/O exception has occurred.
*/
@Test
public void testIsMatching01() throws IOException
{
//
StringList source = null;
String[] regexps = null;
//
Assert.assertEquals(true, StringsUtils.isMatching(source, regexps));
}
/**
* Test is matching 02.
*
* @throws IOException
* Signals that an I/O exception has occurred.
*/
@Test
public void testIsMatching02() throws IOException
{
//
StringList source = new StringList();
String[] regexps = null;
//
Assert.assertEquals(true, StringsUtils.isMatching(source, regexps));
}
/**
* Test is matching 03.
*
* @throws IOException
* Signals that an I/O exception has occurred.
*/
@Test
public void testIsMatching03() throws IOException
{
//
StringList source = null;
String[] regexps = new String[0];
//
Assert.assertEquals(true, StringsUtils.isMatching(source, regexps));
}
/**
* Test is matching 04.
*
* @throws IOException
* Signals that an I/O exception has occurred.
*/
@Test
public void testIsMatching04() throws IOException
{
//
StringList source = new StringList();
String[] regexps = new String[0];
//
Assert.assertEquals(true, StringsUtils.isMatching(source, regexps));
}
/**
* Test is matching 05.
*
* @throws IOException
* Signals that an I/O exception has occurred.
*/
@Test
public void testIsMatching05() throws IOException
{
//
StringList source = new StringList("aaa", "bbb", "ccc");
String[] regexps = null;
//
Assert.assertEquals(false, StringsUtils.isMatching(source, regexps));
}
/**
* Test is matching 06.
*
* @throws IOException
* Signals that an I/O exception has occurred.
*/
@Test
public void testIsMatching06() throws IOException
{
//
StringList source = new StringList("aaa", "bbb", "ccc");
String[] regexps = new String[0];
//
Assert.assertEquals(false, StringsUtils.isMatching(source, regexps));
}
/**
* Test is matching 07.
*
* @throws IOException
* Signals that an I/O exception has occurred.
*/
@Test
public void testIsMatching07() throws IOException
{
//
StringList source = new StringList("aaa", "bbb", "ccc");
String[] regexps = new String[] { "^a+$" };
//
Assert.assertEquals(false, StringsUtils.isMatching(source, regexps));
}
/**
* Test is matching 08.
*
* @throws IOException
* Signals that an I/O exception has occurred.
*/
@Test
public void testIsMatching08() throws IOException
{
//
StringList source = new StringList("aaa", "bbb", "ccc");
String[] regexps = new String[] { "^a+$", "^b+$", "^c+$" };
//
Assert.assertEquals(true, StringsUtils.isMatching(source, regexps));
}
/**
* Test is matching 09.
*
* @throws IOException
* Signals that an I/O exception has occurred.
*/
@Test
public void testIsMatching09() throws IOException
{
//
StringList source = null;
String[] regexps = new String[] { "^a+$", "^b+$", "^c+$" };
//
Assert.assertEquals(false, StringsUtils.isMatching(source, regexps));
}
/**
* Test is matching 10.
*
* @throws IOException
* Signals that an I/O exception has occurred.
*/
@Test
public void testIsMatching10() throws IOException
{
//
StringList source = new StringList();
String[] regexps = new String[] { "^a+$", "^b+$", "^c+$" };
//
Assert.assertEquals(false, StringsUtils.isMatching(source, regexps));
}
/**
* Test is matching 11.
*
* @throws IOException
* Signals that an I/O exception has occurred.
*/
@Test
public void testIsMatching11() throws IOException
{
//
StringList source = new StringList("aaa");
String[] regexps = new String[] { "^a+$", "^b+$", "^c+$" };
//
Assert.assertEquals(false, StringsUtils.isMatching(source, regexps));
}
/**
* Load to string list URL 01.
*
* @throws IOException
* Signals that an I/O exception has occurred.
*/
@Test
public void testLoadResource01() throws IOException
{
//
StringList source = StringsUtils.load(StringsUtilsTest.class.getResource("/fr/devinsy/strings/lines.txt"));
//
Assert.assertEquals(4, source.size());
Assert.assertEquals("trois", source.get(3 - 1));
}
/**
* Test starts with any 01.
*/
@Test
public void testStartsWithAny01()
{
Assert.assertTrue(StringsUtils.startsWithAny("abc", new StringList("aaa", "bb", "ab")));
Assert.assertFalse(StringsUtils.startsWithAny("abc", new StringList("aaa", "bb", "aB")));
}
/**
* Test contains any ignore case 01.
*/
@Test
public void testStartsWithAnyIgnoreCatse01()
{
Assert.assertTrue(StringsUtils.startsWithAnyIgnoreCase("abc", new StringList("aa", "bb", "ab")));
Assert.assertTrue(StringsUtils.startsWithAnyIgnoreCase("abc", new StringList("aa", "bb", "aB")));
Assert.assertFalse(StringsUtils.startsWithAnyIgnoreCase("abc", new StringList("aa", "bb", "cc")));
}
}

View file

@ -0,0 +1,4 @@
un
deux
trois
quatre

View file

@ -1,649 +0,0 @@
/*
* Copyright (C) 2013,2014,2017 Christian Pierre MOMON
*
* This file is part of Devinsy-strings.
*
* Devinsy-strings is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Devinsy-strings is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Devinsy-strings. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.util.strings;
import java.util.Iterator;
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
/**
* The Class StringListTest.
*
* @author Christian Pierre MOMON (christian.momon@devinsy.fr)
*/
public class StringListTest
{
public final org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(StringListTest.class);
/**
* Before.
*/
@Before
public void before()
{
BasicConfigurator.configure();
Logger.getRootLogger().setLevel(Level.ERROR);
}
/**
* Test char at 01.
*/
@Test
public void testCharAt01()
{
//
this.logger.debug("===== test starting...");
//
StringList source = new StringList();
source.append("abcdefghijklm");
//
char target = source.charAt(0);
Assert.assertEquals(target, 'a');
//
target = source.charAt(4);
Assert.assertEquals(target, 'e');
//
target = source.charAt(11);
Assert.assertEquals(target, 'l');
//
this.logger.debug("===== test done.");
}
/**
* Test char at 02.
*/
@Test
public void testCharAt02()
{
//
this.logger.debug("===== test starting...");
//
StringList source = new StringList();
source.append("abc");
source.append("def");
source.append("ghi");
source.append("jkl");
source.append("mno");
//
char target = source.charAt(0);
Assert.assertEquals('a', target);
//
target = source.charAt(4);
Assert.assertEquals('e', target);
//
target = source.charAt(11);
Assert.assertEquals('l', target);
//
this.logger.debug("===== test done.");
}
/**
* Test char at exception 01.
*/
@Test(expected = IndexOutOfBoundsException.class)
public void testCharAtException01()
{
//
this.logger.debug("===== test starting...");
//
StringList source = new StringList();
source.append("abcdefghijklm");
//
char target = source.charAt(-2);
Assert.assertEquals('a', target);
//
this.logger.debug("===== test done.");
}
/**
* Test char at exception 02.
*/
@Test(expected = IndexOutOfBoundsException.class)
public void testCharAtException02()
{
//
this.logger.debug("===== test starting...");
//
StringList source = new StringList();
source.append("abcdefghijklm");
//
char target = source.charAt(100);
Assert.assertEquals('a', target);
//
this.logger.debug("===== test done.");
}
/**
* Test char at exception 03.
*/
@Test(expected = IndexOutOfBoundsException.class)
public void testCharAtException03()
{
//
this.logger.debug("===== test starting...");
//
StringList source = new StringList();
source.append("abcdefghijklm");
//
char target = source.charAt(source.length());
Assert.assertEquals('a', target);
//
this.logger.debug("===== test done.");
}
/**
* Test constructor 01.
*/
@Test
public void testConstructor01()
{
//
this.logger.debug("===== test starting...");
String[] source = { "a", "b", "c" };
//
StringList target = new StringList(source);
Assert.assertEquals(3, target.size());
//
this.logger.debug("===== test done.");
}
/**
* Test constructor 02.
*/
@Test
public void testConstructor02()
{
//
this.logger.debug("===== test starting...");
//
StringList target = new StringList("a", "b", "c");
Assert.assertEquals(3, target.size());
//
this.logger.debug("===== test done.");
}
/**
* Test contains 01.
*/
@Test
public void testContains01()
{
//
this.logger.debug("===== test starting...");
StringList buffer = new StringList();
buffer.append("abc");
buffer.append("def");
buffer.append("ghi");
Assert.assertTrue(buffer.contains("abc"));
Assert.assertTrue(buffer.contains("def"));
Assert.assertTrue(buffer.contains("ghi"));
Assert.assertFalse(buffer.contains("lmn"));
//
this.logger.debug("===== test done.");
}
/**
* Test contains 02.
*/
@Test
public void testContains02()
{
//
this.logger.debug("===== test starting...");
StringList buffer = new StringList();
buffer.append("abc");
buffer.append("def");
buffer.append("ghi");
Assert.assertTrue(buffer.contains(new StringBuffer().append("abc").toString()));
Assert.assertTrue(buffer.contains(new StringBuffer().append("def")));
Assert.assertTrue(buffer.contains(new StringBuffer().append("ghi")));
Assert.assertFalse(buffer.contains(new StringBuffer().append("lmn")));
//
this.logger.debug("===== test done.");
}
/**
* Test contains 02.
*/
@Test
public void testContains03()
{
//
this.logger.debug("===== test starting...");
StringList buffer = new StringList();
buffer.append("abc");
buffer.append("def");
buffer.append("ghi");
Assert.assertTrue(buffer.contains(new StringList().append("abc")));
Assert.assertTrue(buffer.contains(new StringList().append("def")));
Assert.assertTrue(buffer.contains(new StringList().append("ghi")));
Assert.assertFalse(buffer.contains(new StringList().append("lmn")));
//
this.logger.debug("===== test done.");
}
/**
* Test contains any 01.
*/
@Test
public void testContainsAny01()
{
//
this.logger.debug("===== test starting...");
StringList buffer = new StringList();
buffer.append("abc");
buffer.append("def");
buffer.append("ghi");
Assert.assertTrue(buffer.containsAny("abc"));
Assert.assertTrue(buffer.containsAny("def"));
Assert.assertTrue(buffer.containsAny("ghi"));
Assert.assertFalse(buffer.containsAny("aaa"));
//
this.logger.debug("===== test done.");
}
/**
* Test contains any 02.
*/
@Test
public void testContainsAny02()
{
//
this.logger.debug("===== test starting...");
StringList buffer = new StringList();
buffer.append("abc");
buffer.append("def");
buffer.append("ghi");
Assert.assertTrue(buffer.containsAny("aaa", "bbb", "abc"));
Assert.assertTrue(buffer.containsAny("aaa", "bbb", "def"));
Assert.assertTrue(buffer.containsAny("aaa", "bbb", "ghi"));
Assert.assertFalse(buffer.containsAny("aaa", "bbb", "ccc"));
//
this.logger.debug("===== test done.");
}
/**
* Test contains any 03.
*/
@Test
public void testContainsAny03()
{
//
this.logger.debug("===== test starting...");
StringList buffer = new StringList();
buffer.append("abc");
buffer.append("def");
buffer.append("ghi");
Assert.assertTrue(buffer.containsAny(new StringList("aaa", "bbb", "abc")));
Assert.assertTrue(buffer.containsAny(new StringList("aaa", "bbb", "def")));
Assert.assertTrue(buffer.containsAny(new StringList("aaa", "bbb", "ghi")));
Assert.assertFalse(buffer.containsAny(new StringList("aaa", "bbb", "aBc")));
Assert.assertFalse(buffer.containsAny(new StringList("aaa", "bbb", "ccc")));
//
this.logger.debug("===== test done.");
}
/**
* Test contains any 01.
*/
@Test
public void testContainsAnyIgnoreCase01()
{
//
this.logger.debug("===== test starting...");
StringList buffer = new StringList();
buffer.append("abc");
buffer.append("def");
buffer.append("ghi");
Assert.assertTrue(buffer.containsAnyIgnoreCase("aaa", "bbb", "abc"));
Assert.assertTrue(buffer.containsAnyIgnoreCase("aaa", "bbb", "dbf"));
Assert.assertTrue(buffer.containsAnyIgnoreCase("aaa", "bbb", "ghi"));
Assert.assertTrue(buffer.containsAnyIgnoreCase("aaa", "bbb", "Abc"));
Assert.assertTrue(buffer.containsAnyIgnoreCase("aaa", "bbb", "dEf"));
Assert.assertTrue(buffer.containsAnyIgnoreCase("aaa", "bbb", "ghI"));
Assert.assertFalse(buffer.containsAnyIgnoreCase("aaa", "bbb", "ccc"));
//
this.logger.debug("===== test done.");
}
/**
* Test contains any ignore case 02.
*/
@Test
public void testContainsAnyIgnoreCase02()
{
//
this.logger.debug("===== test starting...");
StringList buffer = new StringList();
buffer.append("abc");
buffer.append("def");
buffer.append("ghi");
Assert.assertTrue(buffer.containsAnyIgnoreCase(new StringList("aaa", "bbb", "abc")));
Assert.assertTrue(buffer.containsAnyIgnoreCase(new StringList("aaa", "bbb", "def")));
Assert.assertTrue(buffer.containsAnyIgnoreCase(new StringList("aaa", "bbb", "ghi")));
Assert.assertTrue(buffer.containsAnyIgnoreCase(new StringList("aaa", "bbb", "Abc")));
Assert.assertTrue(buffer.containsAnyIgnoreCase(new StringList("aaa", "bbb", "dEf")));
Assert.assertTrue(buffer.containsAnyIgnoreCase(new StringList("aaa", "bbb", "ghI")));
Assert.assertFalse(buffer.containsAnyIgnoreCase(new StringList("aaa", "bbb", "ccc")));
//
this.logger.debug("===== test done.");
}
/**
* Test iterator of char 01.
*/
@Test
public void testIteratorOfChar01()
{
//
this.logger.debug("===== test starting...");
//
StringList source = new StringList();
source.append("abc");
source.append("def");
source.append("ghi");
source.append("jkl");
source.append("mno");
//
Iterator<Character> iterator = source.iteratorOfChar();
for (int index = 0; index < source.length(); index++)
{
StringListCharPosition position = ((StringListCharIterator) iterator).nextPosition();
System.out.println(index + ":" + source.charAt(index) + " " + position.getCharIndex() + " " + position.getStringIndex() + " " + position.getLocalCharIndex());
Assert.assertTrue(iterator.hasNext());
Character character = ((StringListCharIterator) iterator).next();
Assert.assertEquals(character, new Character(source.charAt(index)));
}
//
this.logger.debug("===== test done.");
}
/**
* Test shrink 01.
*/
@Test
public void testShrink01()
{
//
this.logger.debug("===== test starting...");
//
StringList source = new StringList();
Assert.assertEquals(0, source.size());
source.shrink();
Assert.assertEquals(0, source.size());
//
this.logger.debug("===== test done.");
}
/**
* Test shrink 01.
*/
@Test
public void testShrink02()
{
//
this.logger.debug("===== test starting...");
//
StringList source = new StringList();
source.append("alpha");
source.append("bravo");
source.append("charlie");
source.append("delta");
Assert.assertEquals(4, source.size());
source.shrink();
Assert.assertEquals(1, source.size());
Assert.assertEquals("alphabravocharliedelta", source.get(0));
//
this.logger.debug("===== test done.");
}
/**
* Test substring 01.
*/
@Test
public void testSubstring01()
{
//
this.logger.debug("===== test starting...");
//
StringList source = new StringList();
source.append("hamburger");
//
StringList target = source.substring(4, 8);
Assert.assertEquals("urge", target.toString());
//
this.logger.debug("===== test done.");
}
/**
* Test substring 02.
*/
@Test
public void testSubstring02()
{
//
this.logger.debug("===== test starting...");
//
StringList source = new StringList();
source.append("ham").append("bur").append("ger");
//
StringList target = source.substring(4, 8);
Assert.assertEquals("urge", target.toString());
//
this.logger.debug("===== test done.");
}
/**
* Test substring 03.
*/
@Test
public void testSubstring03()
{
//
this.logger.debug("===== test starting...");
//
StringList source = new StringList();
source.append("smiles");
//
StringList target = source.substring(1, 5);
Assert.assertEquals("mile", target.toString());
//
this.logger.debug("===== test done.");
}
/**
* Test substring 04.
*/
@Test
public void testSubstring04()
{
//
this.logger.debug("===== test starting...");
//
StringList source = new StringList();
source.append("sm").append("il").append("es");
//
StringList target = source.substring(1, 5);
Assert.assertEquals("mile", target.toString());
//
this.logger.debug("===== test done.");
}
/**
* Test to string 01.
*/
@Test
public void testToString01()
{
//
this.logger.debug("===== test starting...");
//
StringList buffer = new StringList();
String target = buffer.toString();
Assert.assertTrue(target.equals(""));
//
this.logger.debug("===== test done.");
}
/**
* Test to string 02.
*/
@Test
public void testToString02()
{
//
this.logger.debug("===== test starting...");
//
String source = "abcdefghijklm";
StringList buffer = new StringList();
buffer.append(source);
String target = buffer.toString();
Assert.assertEquals(source, target);
Assert.assertTrue(target.equals(source));
//
this.logger.debug("===== test done.");
}
/**
* Test to string 03.
*/
@Test
public void testToString03()
{
//
this.logger.debug("===== test starting...");
//
String source1 = "abcdefghijklm";
String source2 = "other stuff";
StringList buffer = new StringList();
buffer.append(source1);
buffer.append(source2);
String target = buffer.toString();
Assert.assertTrue(target.equals(source1 + source2));
//
this.logger.debug("===== test done.");
}
}

View file

@ -1,227 +0,0 @@
/*
* Copyright (C) 2013,2014,2017 Christian Pierre MOMON
*
* This file is part of Devinsy-strings.
*
* Devinsy-strings is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Devinsy-strings is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Devinsy-strings. If not, see <http://www.gnu.org/licenses/>
*/
package fr.devinsy.util.strings;
import java.util.ArrayList;
import java.util.Collection;
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
/**
* The Class StringsUtilsTest.
*
* @author Christian Pierre MOMON (christian.momon@devinsy.fr)
*/
public class StringsUtilsTest
{
public final org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(StringsUtilsTest.class);
/**
* Before.
*/
@Before
public void before()
{
BasicConfigurator.configure();
Logger.getRootLogger().setLevel(Level.ERROR);
}
/**
* Test contains any 01.
*/
@Test
public void testContainsAny01()
{
Assert.assertTrue(StringsUtils.containsAny("abc", "aaa", "bbb", "abc"));
Assert.assertFalse(StringsUtils.containsAny("abc", "aaa", "bbb", "aBc"));
}
/**
* Test contains any ignore case 01.
*/
@Test
public void testContainsAnyIgnoreCase01()
{
Assert.assertTrue(StringsUtils.containsAnyIgnoreCase("abc", "aaa", "bbb", "abc"));
Assert.assertTrue(StringsUtils.containsAnyIgnoreCase("abc", "aaa", "bbb", "aBc"));
Assert.assertFalse(StringsUtils.containsAnyIgnoreCase("abc", "aaa", "bbb", "ccc"));
}
/**
* Test contains blank 01.
*/
@Test
public void testContainsBlank01()
{
Assert.assertFalse(StringsUtils.containsBlank((Collection<String>) null));
Assert.assertFalse(StringsUtils.containsBlank(new StringList("aaa", "bbb", "ccc")));
Assert.assertTrue(StringsUtils.containsBlank(new StringList("aaa", null, "ccc")));
Assert.assertTrue(StringsUtils.containsBlank(new StringList("aaa", "", "ccc")));
Assert.assertTrue(StringsUtils.containsBlank(new StringList("aaa", " ", "ccc")));
}
/**
* Test contains blank 02.
*/
@Test
public void testContainsBlank02()
{
Assert.assertFalse(StringsUtils.containsBlank((String[]) null));
Assert.assertFalse(StringsUtils.containsBlank("aaa", "bbb", "ccc"));
Assert.assertTrue(StringsUtils.containsBlank("aaa", null, "ccc"));
Assert.assertTrue(StringsUtils.containsBlank("aaa", "", "ccc"));
Assert.assertTrue(StringsUtils.containsBlank("aaa", " ", "ccc"));
}
/**
* Test contains blank 03.
*/
@Test
public void testContainsBlank03()
{
Assert.assertFalse(StringsUtils.containsBlank((ArrayList<String>) null));
ArrayList<String> source = new ArrayList<String>();
source.add("aaa");
source.add("bbb");
source.add("ccc");
Assert.assertFalse(StringsUtils.containsBlank(source));
source.set(1, null);
Assert.assertTrue(StringsUtils.containsBlank(source));
source.set(1, "");
Assert.assertTrue(StringsUtils.containsBlank(source));
source.set(1, " ");
Assert.assertTrue(StringsUtils.containsBlank(source));
}
/**
* Test contains empty 01.
*/
@Test
public void testContainsEmpty01()
{
Assert.assertFalse(StringsUtils.containsEmpty((Collection<String>) null));
Assert.assertFalse(StringsUtils.containsEmpty(new StringList("aaa", "bbb", "ccc")));
Assert.assertTrue(StringsUtils.containsEmpty(new StringList("aaa", null, "ccc")));
Assert.assertTrue(StringsUtils.containsEmpty(new StringList("aaa", "", "ccc")));
}
/**
* Test contains empty 02.
*/
@Test
public void testContainsEmpty02()
{
Assert.assertFalse(StringsUtils.containsEmpty((String[]) null));
Assert.assertFalse(StringsUtils.containsEmpty("aaa", "bbb", "ccc"));
Assert.assertTrue(StringsUtils.containsEmpty("aaa", null, "ccc"));
Assert.assertTrue(StringsUtils.containsEmpty("aaa", "", "ccc"));
}
/**
* Test contains empty 03.
*/
@Test
public void testContainsEmpty03()
{
Assert.assertFalse(StringsUtils.containsEmpty((ArrayList<String>) null));
ArrayList<String> source = new ArrayList<String>();
source.add("aaa");
source.add("bbb");
source.add("ccc");
Assert.assertFalse(StringsUtils.containsEmpty(source));
source.set(1, null);
Assert.assertTrue(StringsUtils.containsEmpty(source));
source.set(1, "");
Assert.assertTrue(StringsUtils.containsEmpty(source));
}
/**
* Test contains null 01.
*/
@Test
public void testContainsNull01()
{
Assert.assertFalse(StringsUtils.containsNull((Collection<String>) null));
Assert.assertFalse(StringsUtils.containsNull(new StringList("aaa", "bbb", "ccc")));
Assert.assertTrue(StringsUtils.containsNull(new StringList("aaa", null, "ccc")));
}
/**
* Test contains null 02.
*/
@Test
public void testContainsNull02()
{
Assert.assertFalse(StringsUtils.containsNull((String[]) null));
Assert.assertFalse(StringsUtils.containsNull("aaa", "bbb", "ccc"));
Assert.assertTrue(StringsUtils.containsNull("aaa", null, "ccc"));
}
/**
* Test contains null 03.
*/
@Test
public void testContainsNull03()
{
Assert.assertFalse(StringsUtils.containsNull((ArrayList<String>) null));
ArrayList<String> source = new ArrayList<String>();
source.add("aaa");
source.add("bbb");
source.add("ccc");
Assert.assertFalse(StringsUtils.containsNull(source));
source.set(1, null);
Assert.assertTrue(StringsUtils.containsNull(source));
}
@Test
public void testEqualsAny01()
{
Assert.assertTrue(StringsUtils.equalsAny("abc", "aaa", "bbb", "abc"));
Assert.assertFalse(StringsUtils.equalsAny("abc", "aaa", "bbb", "aBc"));
}
@Test
public void testEqualsAnyIgnoreCase01()
{
Assert.assertTrue(StringsUtils.equalsAnyIgnoreCase("abc", "aaa", "bbb", "abc"));
Assert.assertTrue(StringsUtils.equalsAnyIgnoreCase("abc", "aaa", "bbb", "aBc"));
}
/**
* Test find smallest 01.
*/
@Test
public void testFindSmallest01()
{
// TODO
Assert.assertFalse(StringsUtils.containsNull((ArrayList<String>) null));
ArrayList<String> source = new ArrayList<String>();
source.add("aaa");
source.add("bbb");
source.add("ccc");
Assert.assertFalse(StringsUtils.containsNull(source));
source.set(1, null);
Assert.assertTrue(StringsUtils.containsNull(source));
}
}