ADD file via upload

This commit is contained in:
Adrm 2023-10-05 18:37:19 +08:00
parent 19355985cb
commit 3dbd8caab5
1 changed files with 37 additions and 0 deletions

View File

@ -0,0 +1,37 @@
#ifndef __HASHMAP_H__
#define __HASHMAP_H__
#include<stdlib.h>
#include<string.h>
#include<stdio.h>
typedef struct entry {
void* key;
void* value;
struct entry* next;
} * Entry;
typedef struct hashMap {
int size;
int listSize;
int (*hashCode)(void*);
int (*equal)(void*, void*);
Entry list;
void (*put)(struct hashMap*, void*, void*);
void* (*get)(struct hashMap*, void*);
void (*remove)(struct hashMap*, void*);
void (*clear)(struct hashMap*);
int (*exists)(struct hashMap*, void*);
int autoAssign;
} * HashMap;
HashMap createHashMap(int listSize, int autoAssign);
void defaultPut(HashMap map, void* key, void* value);
void* defaultGet(HashMap map, void* key);
void defaultRemove(HashMap map, void* key);
void defaultClear(HashMap map);
int defaultExists(HashMap map, void* key);
void resetHashMap(HashMap map, int listSize);
#endif // !__HASHMAP_H__