Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 127399

Java (not to be confused with JavaScript) is a class-based, object-oriented, strongly typed, reflective language and run-time environment (JRE). Java programs are compiled to bytecode and run in a virtual machine (JVM) enabling a "write once, run anywhere" (WORA) methodology.

-1 votes

Checks if all items are negative

Bitwise arithmetics are usually the fastest operations for a CPU (hopefully the Java compiler can optimize as such) When predicate gains performance ? … - Stack Overflow Java Stream anyMatch() Tutorial With Examples | kheri.net …
hc_dev's user avatar
  • 822
2 votes

Java grouping based on date and counting

What made me stumble when reading Your use-cases and problem description reads almost fluently and most of it sounds plausible. Though I rarely found names or words from your narrative in your code. M …
hc_dev's user avatar
  • 822
2 votes

Best data Structure for storing a phone keypad format

Also the current situation & given constraints (like only Java-7, minimum time to code, test requires a method, etc.) can heavily reduce solution space and justify design-decisions as rational. … keys pressed are translated to a letter-typed event Design choices Datastructures You can use several datastructures like accessed by a hash-value: Map accessed by a (numerical) index: List or simple Java
hc_dev's user avatar
  • 822
2 votes

Does iterating through a large data set in a Map each time i click impact the performance?

Technical improvements use albumMap.values() to get a Collection<Album> directly instantiated as list, which supports positional access get(index). So no need for array and filling loop. See Listing …
hc_dev's user avatar
  • 822
4 votes
Accepted

TicTacToe implementation in Java

Naming & Readability Choosen naming mostly conveys purpose (expressive) and follows conventions (camelCase). Design & Structure Very good design for a learner: TicTacToe represents a game instanc …
hc_dev's user avatar
  • 822
1 vote

Roman Numeral Conversion in Java

Technical The local variable String str is never used eirhin method convert. So can be removed. Since the map is not supposed to change, make it a static final field, initialized directly or in stat …
hc_dev's user avatar
  • 822
5 votes

Determine if a String has a mirroring head and tail

Such a Palindrome & Java question was Check string for palindrome Inspired by Palindrome checker Inspired by one of the answers which was both concise and elegant: public static boolean isPalindrome …
hc_dev's user avatar
  • 822
7 votes
Accepted

Are two strings anagrams?

does not depend on class state (each execution is determined by parameters only) boolean return signals a kind of test-function, that can be used in if-statments, etc. areAnagrams tells what it does (Java-naming …
hc_dev's user avatar
  • 822
3 votes
Accepted

ID generator class for my Repair Shop Software

First of all we should describe a user-story for your ID-generator. This description should contain use-cases (including examples), requirements, and related technical context. Use-Story As creator …
hc_dev's user avatar
  • 822
3 votes
Accepted

Creating and listing a song collection

use existing collection implementations of Java, as ArrayList or at least wrap them learn the advantages of Single Responsibility Principle (SRP) Here some improvements on modelling and design: use … summary information (aggregation) use separate class for formatting (as everything UI related) Monetary values Monetary values (e.g. prices and costs) can be modeled in different, disputed ways in Java
hc_dev's user avatar
  • 822
3 votes

File System - OOP

In reference to the Java API there may be a name collision, because the class File is also used by Java inside package java.io. …
hc_dev's user avatar
  • 822
6 votes

Program in JAVA to generate random alphanumeric string

See: Math.random() explanation Variable names Typical Java convention would name things using Camel-case. Also following Cleancode would put as much meaning into their names. …
hc_dev's user avatar
  • 822
2 votes

DDD: interaction between 2 objects in a RPG-game

Domain-Driven (Game) Design Naming and terminology of a game (and other applications) follows a convention (depending on its genre). Objects are typically expressed by nouns (N) like: Health and Playe …
hc_dev's user avatar
  • 822
1 vote
Accepted

Is it good way to user dao when assembling dto to entity or not?

Because it maps from object-oriented structures (expressed in Java classes) to relational data structures (expressed in database tables) and back. …
hc_dev's user avatar
  • 822