XDean/Java-EX


Java Common Extension

Download


Step 1. Add the JitPack repository to your build file

Add it in your root settings.gradle at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url 'https://jitpack.io' }
		}
	}

Add it in your settings.gradle.kts at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url = uri("https://jitpack.io") }
		}
	}

Add to pom.xml

	<repositories>
		<repository>
		    <id>jitpack.io</id>
		    <url>https://jitpack.io</url>
		</repository>
	</repositories>

Add it in your build.sbt at the end of resolvers:

 
    resolvers += "jitpack" at "https://jitpack.io"
        
    

Add it in your project.clj at the end of repositories:

 
    :repositories [["jitpack" "https://jitpack.io"]]
        
    

Step 2. Add the dependency

	dependencies {
		implementation 'com.github.XDean:Java-EX:0.1.1'
	}
	dependencies {
		implementation("com.github.XDean:Java-EX:0.1.1")
	}
	<dependency>
	    <groupId>com.github.XDean</groupId>
	    <artifactId>Java-EX</artifactId>
	    <version>0.1.1</version>
	</dependency>

                            
    libraryDependencies += "com.github.XDean" % "Java-EX" % "0.1.1"
        
        

                            
    :dependencies [[com.github.XDean/Java-EX "0.1.1"]]
        
        

Readme


Java-EX

Build Status Code Coverage Code Quality Maven Central

Java Common Extension

Get it

<dependency>
    <groupId>com.github.XDean</groupId>
    <artifactId>Java-EX</artifactId>
    <version>0.1.1</version>
</dependency>

Features

Lang

  • Finalize support. Attach clean up tasks on any object. Free from Object.finalize.
  • Size of object. Measure shallow and retained size of object or class by java code which is useful when debug.

Reflect

  • Add or change annotations on Class/Method/Field at runtime.
  • Get explicit generic type of class or interface.
  • Get caller (any depth in stack) information
  • Get more information of class: getAll(Field/Method/Interface/SuperClass)s, getRoot(Field/Method)

Collection

  • Either. Left or right, that is a question.
  • Pair. Left and right, that is no question.
  • IntList. Operate int array easier. (not java.util.List)
  • TreeNode. A powerful tree implementation. (not dependable yet)
  • Traverse. Traverse any tree structure. Provide default PreOrder/PostOrder/BreadthFirst traverser.

Easy Programming / Function Programming

  • Functions with throws.
  • Ignore checked exception by uncheck.
  • Change throw exception to return it.
  • Cache everywhere like dynamic field.
  • Let everything lambda and let lambda one line:
    • Try
    • If
    • TaskUtil

RxJava Extension

  • From java functions to Rx functions.
  • Use RxNullable to handle null value easily! (RxJava2 don't support null value more and use Irrelevant or Optional everywhere is so ugly).
  • From Observable/Flowable to Iterator.
  • RandomOperator. Easy to shuffle.

Other many utilities

See the code!