This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package typeInference | |
| import "golang.org/x/exp/constraints" | |
| type Point []int32 | |
| func ConstraintTypeInference(){ | |
| constraintTypeInferenceDemo(Point{1,2},4) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package typeInference | |
| import ( | |
| "fmt" | |
| "golang.org/x/exp/constraints" | |
| ) | |
| func TypeInferenceDemo(){ | |
| fmt.Println(GenericAdd(2,4)) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type OldInterface interface { | |
| a(_int int32) | |
| b(_float float32) | |
| } | |
| type OldInterfaceType struct { | |
| } | |
| func (O OldInterfaceType)a(_int int32) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import "golang.org/x/exp/constraints" | |
| type Animal[T constraints.Ordered, K constraints.Float] struct { | |
| Height K | |
| Metadata []T | |
| } | |
| func TypeType() Animal[string,float32]{ | |
| A :=Animal[string,float32]{} | |
| A.Height = 67.89 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "golang.org/x/exp/constraints" | |
| ) | |
| func main() { | |
| fmt.Println(GenericMul[float32](2.1,3.2)) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //for android made following changes | |
| //1)AndroidManifest.xml | |
| //<uses-permission android:name="android.permission.CAMERA" /> | |
| //2) Android/app/build.gradle | |
| //defaultConfig { | |
| // missingDimensionStrategy 'react-native-camera', 'general' // <--- insert this line | |
| //} | |
| import React, {Component} from 'react'; | |
| import { | |
| Text, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main.reactiveAPI; | |
| public class Employee { | |
| private int id; | |
| private String fname; | |
| private String sname; | |
| private String fullName; | |
| public String getFullName() { | |
| return fullName; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module main { | |
| requires jdk.incubator.httpclient; | |
| } | |
| public class NewHttpClientDemo { | |
| public void demo() { | |
| try{ | |
| HttpClient httpClient = HttpClient.newHttpClient(); | |
| HttpRequest httpRequest = HttpRequest | |
| .newBuilder() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public interface javaNineInterface { | |
| String JAVA_VERSION = "9"; | |
| default void logVersion(String msg){ | |
| log(msg); | |
| } | |
| default void logAuthor(String msg){ | |
| log(msg); | |
| } | |
| private void log(String msg){ | |
| System.out.println(msg); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| default Stream<T> takeWhile(Predicate<? super T> predicate) | |
| private Stream stream = Stream.of(1,2,10,3,4,5,6,7,8,9); | |
| stream.takeWhile(x -> (Integer)x < 4).forEach(a -> System.out.println(a)); |
NewerOlder