Skip to content
This repository has been archived by the owner on Jan 4, 2024. It is now read-only.

Commit

Permalink
1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
FazziCLAY committed Aug 4, 2022
1 parent 0557abf commit 7bcffce
Show file tree
Hide file tree
Showing 21 changed files with 460 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/artifacts/JavaNeoUtil_jar.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions JavaNeoUtil.iml
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>
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 Mironov Stanislav
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
Expand All @@ -18,4 +18,4 @@ 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.
SOFTWARE.
Binary file added out/artifacts/JavaNeoUtil_jar/JavaNeoUtil-1.0.jar
Binary file not shown.
Binary file not shown.
3 changes: 3 additions & 0 deletions out/production/JavaNeoUtil/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Created-By: FazziCLAY

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
3 changes: 3 additions & 0 deletions src/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Created-By: FazziCLAY

70 changes: 70 additions & 0 deletions src/ru/fazziclay/javaneoutil/ArrayUtil.java
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;
}
}
}
Loading

0 comments on commit 7bcffce

Please sign in to comment.