Coder Social home page Coder Social logo

java-data-structures's People

Contributors

marioluan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

java-data-structures's Issues

upgrade to java 9

  • use factory methods from Collections:
Set<String> alphabet = Set.of("a", "b", "c");

Can't connect to X11 window server

Try to run:

$ docker-compose up
Recreating java-data-structures_intellij_1 ... done
Starting java-data-structures_gradle_1     ... done
Attaching to java-data-structures_gradle_1, java-data-structures_intellij_1
gradle_1    | Starting a Gradle Daemon, 1 incompatible and 2 stopped Daemons could not be reused, use --status for details
intellij_1  | No protocol specified
intellij_1  | 
intellij_1  | Start Failed: Failed to initialize graphics environment
intellij_1  | 
intellij_1  | java.awt.AWTError: Can't connect to X11 window server using ':0' as the value of the DISPLAY variable.
intellij_1  | 	at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
intellij_1  | 	at sun.awt.X11GraphicsEnvironment.access$200(X11GraphicsEnvironment.java:65)
intellij_1  | 	at sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:115)
intellij_1  | 	at java.security.AccessController.doPrivileged(Native Method)
intellij_1  | 	at sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:74)
intellij_1  | 	at java.lang.Class.forName0(Native Method)
intellij_1  | 	at java.lang.Class.forName(Class.java:264)
intellij_1  | 	at java.awt.GraphicsEnvironment.createGE(GraphicsEnvironment.java:103)
intellij_1  | 	at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:82)
intellij_1  | 	at sun.awt.X11.XToolkit.<clinit>(XToolkit.java:127)
intellij_1  | 	at java.lang.Class.forName0(Native Method)
intellij_1  | 	at java.lang.Class.forName(Class.java:264)
intellij_1  | 	at java.awt.Toolkit$2.run(Toolkit.java:860)
intellij_1  | 	at java.awt.Toolkit$2.run(Toolkit.java:855)
intellij_1  | 	at java.security.AccessController.doPrivileged(Native Method)
intellij_1  | 	at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:854)
intellij_1  | 	at java.awt.Toolkit.getEventQueue(Toolkit.java:1736)
intellij_1  | 	at java.awt.EventQueue.isDispatchThread(EventQueue.java:1071)
intellij_1  | 	at javax.swing.SwingUtilities.isEventDispatchThread(SwingUtilities.java:1361)
intellij_1  | 	at javax.swing.text.StyleContext.reclaim(StyleContext.java:454)
intellij_1  | 	at javax.swing.text.StyleContext.addAttribute(StyleContext.java:311)
intellij_1  | 	at javax.swing.text.html.StyleSheet.addAttribute(StyleSheet.java:578)
intellij_1  | 	at javax.swing.text.StyleContext$NamedStyle.addAttribute(StyleContext.java:1501)
intellij_1  | 	at javax.swing.text.StyleContext$NamedStyle.setName(StyleContext.java:1312)
intellij_1  | 	at javax.swing.text.StyleContext$NamedStyle.<init>(StyleContext.java:1259)
intellij_1  | 	at javax.swing.text.StyleContext.addStyle(StyleContext.java:107)
intellij_1  | 	at javax.swing.text.StyleContext.<init>(StyleContext.java:87)
intellij_1  | 	at javax.swing.text.html.StyleSheet.<init>(StyleSheet.java:166)
intellij_1  | 	at javax.swing.text.html.HTMLEditorKit.getStyleSheet(HTMLEditorKit.java:391)
intellij_1  | 	at com.intellij.util.ui.UIUtil.<clinit>(UIUtil.java:103)
intellij_1  | 	at com.intellij.ide.plugins.PluginManager.start(PluginManager.java:78)
intellij_1  | 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
intellij_1  | 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
intellij_1  | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
intellij_1  | 	at java.lang.reflect.Method.invoke(Method.java:498)
intellij_1  | 	at com.intellij.ide.Bootstrap.main(Bootstrap.java:39)
intellij_1  | 	at com.intellij.idea.Main.main(Main.java:78)
intellij_1  | 
java-data-structures_intellij_1 exited with code 3
gradle_1    | :help
gradle_1    | 
gradle_1    | Welcome to Gradle 4.5.1.
gradle_1    | 
gradle_1    | To run a build, run gradle <task> ...
gradle_1    | 
gradle_1    | To see a list of available tasks, run gradle tasks
gradle_1    | 
gradle_1    | To see a list of command-line options, run gradle --help
gradle_1    | 
gradle_1    | To see more detail about a task, run gradle help --task <task>
gradle_1    | 
gradle_1    | BUILD SUCCESSFUL in 21s
gradle_1    | 1 actionable task: 1 executed
java-data-structures_gradle_1 exited with code 0

Output of DISPLAY variable:

$ echo $DISPLAY
:0

I am using Ubuntu 18.04.
What can be wrong setuped?

Refactor Separate Chaining Hash

TODO

  • fix resize threshold
  • use a linked list data structure instead of a node
  • throw IllegalArgumentException when argument is null

fix TODOs

:checkstyleMain[ant:checkstyle] [INFO] /home/gradle/src/main/java/io/github/marioluan/datastructures/Node.java:16:14: Variable 'data' must be private and have accessor methods. [VisibilityModifier]
[ant:checkstyle] [INFO] /home/gradle/src/main/java/io/github/marioluan/datastructures/Node.java:21:20: Variable 'next' must be private and have accessor methods. [VisibilityModifier]
[ant:checkstyle] [INFO] /home/gradle/src/main/java/io/github/marioluan/datastructures/Node.java:26:20: Variable 'prev' must be private and have accessor methods. [VisibilityModifier]
[ant:checkstyle] [INFO] /home/gradle/src/main/java/io/github/marioluan/datastructures/graph/Digraph.java:55: Comment matches to-do format 'TODO'. [TodoComment]
[ant:checkstyle] [INFO] /home/gradle/src/main/java/io/github/marioluan/datastructures/graph/Undirected.java:56: Comment matches to-do format 'TODO'. [TodoComment]
[ant:checkstyle] [INFO] /home/gradle/src/main/java/io/github/marioluan/datastructures/graph/search/BreadthFirstSearch.java:34: Comment matches to-do format 'TODO'. [TodoComment]
[ant:checkstyle] [INFO] /home/gradle/src/main/java/io/github/marioluan/datastructures/graph/search/ConnectedComponents.java:43: Comment matches to-do format 'TODO'. [TodoComment]
[ant:checkstyle] [INFO] /home/gradle/src/main/java/io/github/marioluan/datastructures/graph/search/Paths.java:25: Comment matches to-do format 'TODO'. [TodoComment]
[ant:checkstyle] [INFO] /home/gradle/src/main/java/io/github/marioluan/datastructures/priority/queue/MaxBinaryHeap.java:10: Comment matches to-do format 'TODO'. [TodoComment]
[ant:checkstyle] [INFO] /home/gradle/src/main/java/io/github/marioluan/datastructures/symboltable/BinarySearchTree.java:487: Comment matches to-do format 'TODO'. [TodoComment]

fix intermittent boken unit test for LinearProbingHashTable

Broken test:

// spec from #get method
describe("when key does not exist", () -> {
  it("returns null", () -> {
    assertNull(this.subject.get(String.valueOf(RANDOM.nextInt())));
  });
});

Error message:

io.github.marioluan.datastructures.symboltable.hash.LinearProbingHashTableTest > when key does not exist.returns null FAILED
    java.lang.ArrayIndexOutOfBoundsException

Looks like some random integer is causing issue.

fix broken tests for SeparateChainingHashTest

io.github.marioluan.datastructures.symboltable.hash.SeparateChainingHashTest > when it is not empty.returns false FAILED
    java.lang.ArithmeticException
io.github.marioluan.datastructures.symboltable.hash.SeparateChainingHashTest > when it is not empty.returns its @size FAILED
    java.lang.ArithmeticException
io.github.marioluan.datastructures.symboltable.hash.SeparateChainingHashTest > when key is not null.does not throw null pointer FAILED
    java.lang.ArithmeticException
io.github.marioluan.datastructures.symboltable.hash.SeparateChainingHashTest > when value is null.removes the key from table FAILED
    java.lang.ArithmeticException
io.github.marioluan.datastructures.symboltable.hash.SeparateChainingHashTest > when value is null.decrements size by 1 FAILED
    java.lang.ArithmeticException
io.github.marioluan.datastructures.symboltable.hash.SeparateChainingHashTest > when value is not null.updates the key from table FAILED
    java.lang.ArithmeticException
io.github.marioluan.datastructures.symboltable.hash.SeparateChainingHashTest > when value is not null.does not updates its size FAILED
    java.lang.ArithmeticException
io.github.marioluan.datastructures.symboltable.hash.SeparateChainingHashTest > when value is null.removes the key from table FAILED
    java.lang.ArithmeticException
io.github.marioluan.datastructures.symboltable.hash.SeparateChainingHashTest > when value is null.decrements size by 1 FAILED
    java.lang.ArithmeticException
io.github.marioluan.datastructures.symboltable.hash.SeparateChainingHashTest > when value is not null.updates the key from table FAILED
    java.lang.ArithmeticException
io.github.marioluan.datastructures.symboltable.hash.SeparateChainingHashTest > when value is not null.does not updates its size FAILED
    java.lang.ArithmeticException
io.github.marioluan.datastructures.symboltable.hash.SeparateChainingHashTest > when value is null.does not add the key to table FAILED
    java.lang.ArithmeticException
io.github.marioluan.datastructures.symboltable.hash.SeparateChainingHashTest > when value is not null.adds the key to table FAILED
    java.lang.ArithmeticException
io.github.marioluan.datastructures.symboltable.hash.SeparateChainingHashTest > when value is not null.increments size by 1 FAILED
    java.lang.ArithmeticException
io.github.marioluan.datastructures.symboltable.hash.SeparateChainingHashTest > when key is not null.does not throw null pointer FAILED
    java.lang.ArithmeticException
io.github.marioluan.datastructures.symboltable.hash.SeparateChainingHashTest > when table is empty.returns null FAILED
    java.lang.ArithmeticException
io.github.marioluan.datastructures.symboltable.hash.SeparateChainingHashTest > when key exists.returns the value paired with it FAILED
    java.lang.ArithmeticException
io.github.marioluan.datastructures.symboltable.hash.SeparateChainingHashTest > when key does not exist.returns null FAILED
    java.lang.ArithmeticException
io.github.marioluan.datastructures.symboltable.hash.SeparateChainingHashTest > when key exists.returns the value paired with it FAILED
    java.lang.ArithmeticException
io.github.marioluan.datastructures.symboltable.hash.SeparateChainingHashTest > when key does not exist.returns null FAILED
    java.lang.ArithmeticException
io.github.marioluan.datastructures.symboltable.hash.SeparateChainingHashTest > when key is at the top of the bucket.removes the key from table FAILED
    java.lang.ArithmeticException
io.github.marioluan.datastructures.symboltable.hash.SeparateChainingHashTest > when key is at the middle/bottom of the bucket.removes the key from table FAILED
    java.lang.ArithmeticException
io.github.marioluan.datastructures.symboltable.hash.SeparateChainingHashTest > when the buckets have a single element.returns the keys from the table FAILED
    java.lang.ArithmeticException
io.github.marioluan.datastructures.symboltable.hash.SeparateChainingHashTest > when the buckets have multiple elements.returns the keys from the table FAILED
    java.lang.ArithmeticException
233 tests completed, 24 failed, 10 skipped

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.