This repository has been archived by the owner on Jan 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
460 additions
and
2 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<module type="JAVA_MODULE" version="4"> | ||
<component name="NewModuleRootManager" inherit-compiler-output="true"> | ||
<exclude-output /> | ||
<content url="file://$MODULE_DIR$"> | ||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> | ||
</content> | ||
<orderEntry type="inheritedJdk" /> | ||
<orderEntry type="sourceFolder" forTests="false" /> | ||
</component> | ||
</module> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file added
BIN
+6.56 KB
out/artifacts/JavaNeoUtil_jar/sources-javadoc/JavaNeoUtil-1.0-sources-javadoc.jar
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Manifest-Version: 1.0 | ||
Created-By: FazziCLAY | ||
|
Binary file added
BIN
+406 Bytes
out/production/JavaNeoUtil/ru/fazziclay/javaneoutil/ArrayUtil$SortStringConsumer.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+425 Bytes
out/production/JavaNeoUtil/ru/fazziclay/javaneoutil/JavaNeoUtil.class
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Manifest-Version: 1.0 | ||
Created-By: FazziCLAY | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
package ru.fazziclay.javaneoutil; | ||
|
||
/** | ||
MIT License | ||
Copyright (c) 2022 Mironov Stanislav (FazziCLAY) | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
**/ | ||
|
||
/** | ||
* Набот утилит для сортировки | ||
* @author FazziCLAY ( https://fazziclay.github.io ) | ||
* **/ | ||
public class ArrayUtil { | ||
/** | ||
* Перерасположить(сортировать) массив list по тексту элемента, тест достаётся с помощью {@link SortStringConsumer} | ||
* **/ | ||
public static <T> void sortByName(T[] list, SortStringConsumer<T> consumer) { | ||
int n = list.length; | ||
T temp; | ||
|
||
for (int i = 0; i < n; i++) { | ||
for (int j = i + 1; j < n; j++) { | ||
T oI = list[i]; | ||
T oJ = list[j]; | ||
|
||
String s1 = consumer.get(oI); | ||
String s2 = consumer.get(oJ); | ||
if (s1 == null) s1 = ""; | ||
if (s2 == null) s2 = ""; | ||
|
||
if (s1.compareTo(s2) > 0) { | ||
temp = list[i]; | ||
list[i] = list[j]; | ||
list[j] = temp; | ||
} | ||
} | ||
} | ||
} | ||
|
||
public interface SortStringConsumer<T> { | ||
String get(T o); | ||
} | ||
|
||
public static <T> void reverse(T[] list) { | ||
for (int i = 0; i < list.length; i++) { | ||
int iRev = list.length - 1 - i; | ||
T temp = list[i]; | ||
list[i] = list[iRev]; | ||
list[iRev] = temp; | ||
} | ||
} | ||
} |
Oops, something went wrong.