Skip to content

Commit 0cd2545

Browse files
committed
first commit
0 parents  commit 0cd2545

21 files changed

+562
-0
lines changed

.gitignore

+221
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,221 @@
1+
2+
### Eclipse ###
3+
.metadata
4+
bin/
5+
tmp/
6+
*.tmp
7+
*.bak
8+
*.swp
9+
*~.nib
10+
local.properties
11+
.settings/
12+
.loadpath
13+
.recommenders
14+
15+
# External tool builders
16+
.externalToolBuilders/
17+
18+
# Locally stored "Eclipse launch configurations"
19+
*.launch
20+
21+
# PyDev specific (Python IDE for Eclipse)
22+
*.pydevproject
23+
24+
# CDT-specific (C/C++ Development Tooling)
25+
.cproject
26+
27+
# CDT- autotools
28+
.autotools
29+
30+
# Java annotation processor (APT)
31+
.factorypath
32+
33+
# PDT-specific (PHP Development Tools)
34+
.buildpath
35+
36+
# sbteclipse plugin
37+
.target
38+
39+
# Tern plugin
40+
.tern-project
41+
42+
# TeXlipse plugin
43+
.texlipse
44+
45+
# STS (Spring Tool Suite)
46+
.springBeans
47+
48+
# Code Recommenders
49+
.recommenders/
50+
51+
# Annotation Processing
52+
.apt_generated/
53+
.apt_generated_test/
54+
55+
# Scala IDE specific (Scala & Java development for Eclipse)
56+
.cache-main
57+
.scala_dependencies
58+
.worksheet
59+
60+
# Uncomment this line if you wish to ignore the project description file.
61+
# Typically, this file would be tracked if it contains build/dependency configurations:
62+
#.project
63+
64+
### Eclipse Patch ###
65+
# Spring Boot Tooling
66+
.sts4-cache/
67+
68+
### Intellij+all ###
69+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
70+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
71+
72+
# User-specific stuff
73+
.idea
74+
.idea/**/workspace.xml
75+
.idea/**/tasks.xml
76+
.idea/**/usage.statistics.xml
77+
.idea/**/dictionaries
78+
.idea/**/shelf
79+
80+
# AWS User-specific
81+
.idea/**/aws.xml
82+
83+
# Generated files
84+
.idea/**/contentModel.xml
85+
86+
# Sensitive or high-churn files
87+
.idea/**/dataSources/
88+
.idea/**/dataSources.ids
89+
.idea/**/dataSources.local.xml
90+
.idea/**/sqlDataSources.xml
91+
.idea/**/dynamic.xml
92+
.idea/**/uiDesigner.xml
93+
.idea/**/dbnavigator.xml
94+
95+
# Gradle
96+
.idea/**/gradle.xml
97+
.idea/**/libraries
98+
99+
# Gradle and Maven with auto-import
100+
# When using Gradle or Maven with auto-import, you should exclude module files,
101+
# since they will be recreated, and may cause churn. Uncomment if using
102+
# auto-import.
103+
# .idea/artifacts
104+
# .idea/compiler.xml
105+
# .idea/jarRepositories.xml
106+
# .idea/modules.xml
107+
# .idea/*.iml
108+
# .idea/modules
109+
*.iml
110+
111+
# *.ipr
112+
113+
# CMake
114+
cmake-build-*/
115+
116+
# Mongo Explorer plugin
117+
.idea/**/mongoSettings.xml
118+
119+
# File-based project format
120+
*.iws
121+
122+
# IntelliJ
123+
out/
124+
125+
# mpeltonen/sbt-idea plugin
126+
.idea_modules/
127+
128+
# JIRA plugin
129+
atlassian-ide-plugin.xml
130+
131+
# Cursive Clojure plugin
132+
.idea/replstate.xml
133+
134+
# SonarLint plugin
135+
.idea/sonarlint/
136+
137+
# Crashlytics plugin (for Android Studio and IntelliJ)
138+
com_crashlytics_export_strings.xml
139+
crashlytics.properties
140+
crashlytics-build.properties
141+
fabric.properties
142+
143+
# Editor-based Rest Client
144+
.idea/httpRequests
145+
146+
# Android studio 3.1+ serialized cache file
147+
.idea/caches/build_file_checksums.ser
148+
149+
### Intellij+all Patch ###
150+
# Ignore everything but code style settings and run configurations
151+
# that are supposed to be shared within teams.
152+
153+
.idea/*
154+
155+
!.idea/codeStyles
156+
!.idea/runConfigurations
157+
158+
### Java ###
159+
# Compiled class file
160+
*.class
161+
162+
# Log file
163+
*.log
164+
165+
# BlueJ files
166+
*.ctxt
167+
168+
# Mobile Tools for Java (J2ME)
169+
.mtj.tmp/
170+
171+
# Package Files #
172+
*.jar
173+
*.war
174+
*.nar
175+
*.ear
176+
*.zip
177+
*.tar.gz
178+
*.rar
179+
180+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
181+
hs_err_pid*
182+
replay_pid*
183+
184+
### Maven ###
185+
target/
186+
pom.xml.tag
187+
pom.xml.releaseBackup
188+
pom.xml.versionsBackup
189+
pom.xml.next
190+
release.properties
191+
dependency-reduced-pom.xml
192+
buildNumber.properties
193+
.mvn/timing.properties
194+
# https://github.com/takari/maven-wrapper#usage-without-binary-jar
195+
.mvn/wrapper/maven-wrapper.jar
196+
197+
# Eclipse m2e generated files
198+
# Eclipse Core
199+
.project
200+
# JDT-specific (Eclipse Java Development Tools)
201+
.classpath
202+
203+
### VisualStudioCode ###
204+
.vscode/*
205+
!.vscode/settings.json
206+
!.vscode/tasks.json
207+
!.vscode/launch.json
208+
!.vscode/extensions.json
209+
!.vscode/*.code-snippets
210+
211+
# Local History for Visual Studio Code
212+
.history/
213+
214+
# Built Visual Studio Code Extensions
215+
*.vsix
216+
217+
### VisualStudioCode Patch ###
218+
# Ignore all local history of files
219+
.history
220+
.ionide
221+

README.md

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Nuevas features en Java
2+
3+
Algunas de las mejoras introducidas en Java desde la versión 8 hasta la LTS 17:
4+
5+
* Inferencia de tipos
6+
* Bloques String
7+
* Herencia sellada
8+
* Mejoras en interfaces: métodos default, métodos privados, métodos estáticos
9+
* Expresiones switch
10+
* Tipos Record

pom.xml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>org.example</groupId>
8+
<artifactId>java-new-features</artifactId>
9+
<version>1.0-SNAPSHOT</version>
10+
11+
<properties>
12+
<maven.compiler.source>18</maven.compiler.source>
13+
<maven.compiler.target>18</maven.compiler.target>
14+
</properties>
15+
16+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package com.example.interfaces.defaultmethods;
2+
3+
public interface EmployeeDAO {
4+
5+
String saludo();
6+
7+
default String despedida() {
8+
return "Hasta luego";
9+
}
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package com.example.interfaces.defaultmethods;
2+
3+
public class EmployeeDAOImpl implements EmployeeDAO {
4+
@Override
5+
public String saludo() {
6+
return "Hola mundo";
7+
}
8+
9+
@Override
10+
public String despedida() {
11+
// return EmployeeDAO.super.despedida();
12+
return "Hasta nunca";
13+
}
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.example.interfaces.defaultmethods;
2+
3+
public class Main {
4+
5+
public static void main(String[] args) {
6+
7+
EmployeeDAO employeeDAO = new EmployeeDAOImpl();
8+
System.out.println(employeeDAO.saludo());
9+
System.out.println(employeeDAO.despedida());
10+
}
11+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.example.interfaces.privatemethods;
2+
3+
public interface Calculator {
4+
5+
6+
double IVA = 0.21;
7+
8+
default double sumPrices(double price1, double price2){
9+
double totalPrice1 = price1 + calculateIVA(price1);
10+
double totalPrice2 = price2 + calculateIVA(price2);
11+
return totalPrice1 + totalPrice2;
12+
}
13+
14+
private double calculateIVA(double price){
15+
return price * IVA;
16+
}
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package com.example.interfaces.staticmethods;
2+
3+
public class BasicCalculator implements Calculator {
4+
@Override
5+
public int sum(int num1, int num2) {
6+
return num1 + num2;
7+
}
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package com.example.interfaces.staticmethods;
2+
3+
public interface Calculator {
4+
5+
int sum(int num1, int num2);
6+
7+
static Calculator getInstance(){
8+
return new BasicCalculator();
9+
}
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package com.example.interfaces.staticmethods;
2+
3+
public class Main {
4+
5+
public static void main(String[] args) {
6+
7+
var calculator = Calculator.getInstance();
8+
System.out.println(calculator.sum(5, 5));
9+
}
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
package com.example.record;
2+
3+
// Clase normal
4+
public class Customer {
5+
private Long id;
6+
private String name;
7+
private Double salary;
8+
9+
public Customer() {
10+
}
11+
12+
public Customer(Long id, String name, Double salary) {
13+
this.id = id;
14+
this.name = name;
15+
this.salary = salary;
16+
}
17+
18+
public Long getId() {
19+
return id;
20+
}
21+
22+
public void setId(Long id) {
23+
this.id = id;
24+
}
25+
26+
public String getName() {
27+
return name;
28+
}
29+
30+
public void setName(String name) {
31+
this.name = name;
32+
}
33+
34+
public Double getSalary() {
35+
return salary;
36+
}
37+
38+
public void setSalary(Double salary) {
39+
this.salary = salary;
40+
}
41+
42+
@Override
43+
public String toString() {
44+
return "Customer{" +
45+
"id=" + id +
46+
", name='" + name + '\'' +
47+
", salary=" + salary +
48+
'}';
49+
}
50+
}

0 commit comments

Comments
 (0)