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 com.github.qiushijie; | |
import java.util.LinkedList; | |
import java.util.List; | |
public class A_23树 { | |
public static void main(String[] args) { | |
Tree23 tree23 = new Tree23(10); | |
// |
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 class Skiplist { | |
/** | |
* 最大层级数 | |
*/ | |
private static final int MAX_LEVEL = 64; | |
/** | |
* 概率 | |
*/ |
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 class MyCountDownLatch { | |
private static class Sync extends AbstractQueuedSynchronizer { | |
public Sync(int count) { | |
setState(count); | |
} | |
/** | |
* 返回值 >= 0 说明获取锁成功 |
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 class MyReentrantLock implements Lock { | |
private static class Sync extends AbstractQueuedSynchronizer { | |
@Override | |
protected boolean tryAcquire(int arg) { | |
// 确保入参为 1,封装可自行根据业务传 | |
assert arg == 1; | |
// AQS 就是对 state (状态) 进行操作 | |
// 这里我们获取锁后把 state 设置为大于 0 |
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 com.github.qiushijie; | |
import java.util.concurrent.*; | |
import java.util.stream.IntStream; | |
import java.util.stream.LongStream; | |
public class ForkJoinPoolExample { | |
public static void main(String[] args) { | |
// sleepTask(); |
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 React from 'react'; | |
import {Animated, Dimensions, EmitterSubscription, Keyboard, Platform, TextInput, UIManager} from 'react-native'; | |
import {NavigationEventSubscription, NavigationScreenProp} from 'react-navigation'; | |
interface IState { | |
height: Animated.Value; | |
} | |
export interface KeyboardAvoidingViewProps { | |
navigation: NavigationScreenProp<any, any>; |
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 * as React from 'react'; | |
import {Animated, Dimensions, StyleSheet, Text, TextStyle, View, ViewStyle} from 'react-native'; | |
const {width, height} = Dimensions.get('window'); | |
interface IProps { | |
textStyle?: TextStyle; | |
containerStyle?: ViewStyle; | |
position?: 'top' | 'center' | 'bottom'; | |
opacity?: number; |
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
const TokenTypes = { | |
OPEN_OBJECT: '{', | |
CLOSE_OBJECT: '}', | |
OPEN_ARRAY: '[', | |
CLOSE_ARRAY: ']', | |
KEY: 'key', | |
STRING: 'string', | |
NUMBER: 'number', | |
TRUE: 'true', | |
FALSE: 'false', |