Coder Social home page Coder Social logo

iluwatar / 30-seconds-of-java Goto Github PK

View Code? Open in Web Editor NEW
970.0 37.0 377.0 453 KB

Collection of reusable tested Java 17 compatible code snippets that you can understand in 30 seconds or less.

Home Page: https://java-design-patterns.com/snippets.html

License: MIT License

Java 100.00%
java snippets snippets-collection snippets-library awesome-list hacktoberfest

30-seconds-of-java's People

Contributors

alidehkhodaei avatar allcontributors[bot] avatar awais-latif avatar bennyen avatar berry120 avatar bhaskar1312 avatar byoungju94 avatar charlesfinley avatar damonxue avatar eimanip avatar grzesiekkedzior avatar hammadsaedi avatar iluwatar avatar jeff303 avatar jso4342 avatar klurpicolo avatar luismateoh avatar lukasb1b avatar manishdait avatar nikhilbarar avatar nishant- avatar paladitya avatar raja-peeyush-kumar-singh avatar sean-leichtle avatar sendhilkumara avatar shanty97 avatar swarajsaaj avatar varunu28 avatar vedantzope9 avatar yorlov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

30-seconds-of-java's Issues

O(1) space palindrome check

The current palindrome check snippet uses O(n) space, it can be improved to use O(1) space with this simple algorithm:

  public static boolean isPalindrome(String s) {
    for (int i = 0, j = s.length() - 1; i < j; i++, j--) {
      while (i < j && !Character.isLetter(s.charAt(i))) {
        i++;
      }
      while (i < j && !Character.isLetter(s.charAt(j))) {
        j--;
      }

      if (Character.toLowerCase(s.charAt(i)) != Character.toLowerCase(s.charAt(j))) {
        return false;
      }
    }

    return true;
  }

Need help with Korean translation

To show the code snippets correctly on the Korean website, we need a translation of README.md. The result of the translation should be placed to localization/ko/README.md.

Acceptance criteria

  • README.md translated to Korean

Windows build fails: 86 tests completed, 2 failed

Hello, I running ./gradlew clean build but 2 test faild. May it occure only on my system?
More detail:

86 tests completed, 2 failed

  1. ListFilesInDirectorySnippetTest > testListFilesInDirectory() FAILED
    org.opentest4j.AssertionFailedError at ListFilesInDirectorySnippetTest.java:48

  2. InputStreamToStringSnippetTest > testInputStreamToString() FAILED
    org.opentest4j.AssertionFailedError at InputStreamToStringSnippetTest.java:52

Need help with Chinese translation

To show the code snippets correctly on the Chinese website, we need a translation of README.md. The result of the translation should be placed to localization/zh/README.md.

Acceptance criteria

  • README.md translated to Chinese

Upgrade Checkstyle

The project currently uses a custom checkstyle configuration in config/checkstyle.xml. In this task let's upgrade Checkstyle and start using the built-in Google checks instead of a custom configuration.

Acceptance criteria

  • Checkstyle updated to the latest version
  • Checkstyle uses Google checks instead of the custom config

Create CI build

To make it easier to quality control the incoming pull requests, we should have a CI build.

Acceptance criteria

  • Github Actions based CI-build has been created
  • Builds the main branch when it changes
  • Incoming pull requests are checked

HttpPostSnippetTest.testHttpPost failing

Hello, In the HttpPostSnippetTest class, the testHttpPost method is failing. This method is intended to test the behavior of an HTTP POST request, but it's currently failing for some reason.

Provide Search Bar

Can provide a search bar so that if user want for a specific algorithm, user can search it.

Add Euclid's algorithm

It is a procedure used to find the greatest common divisors of two positive integers.

Library Enhancement (separate each source code)

I just realized that the library is one big file, this will be problematic each time this file is modified.

Can we separate each source code as one file?

I think, this is the best we can do to avoid merge conflicts. For example, lines 5-10 is for a specific code, now two pull requests change the same file, in one pull request, the code was changed before lines 5-10, so now, the mentioned specific code 5-10 will be adjusted. The second pull request will have a merge conflict because of that.

And as you can see, if someone will use a specific code in that library, he/she will have a hard time finding all the specific imports for that specific source code, unlike when the source code is just one file, for example, a code for binary search, he/she can simple get it as one file.

Improve consistency

While the snippet GetAllMethodsSnippet uses a traditional for loop, and there's nothing wrong with that, I think it might be a good idea to swap for using streams, just because the others in same category (Class) do so.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.